Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function changes the layout of a device context (DC).

Syntax

DWORD SetLayout(
  HDC 
hdc,
  DWORD 
dwLayout,
);

Parameters

hdc

[in] Handle to the DC.

dwLayout

[in] Specifies the DC layout. This parameter can be a combination of one or more of the following flags.

Flag Description

LAYOUT_BITMAPORIENTATIONPRESERVED

Not supported.

LAYOUT_RTL

Sets the default horizontal layout to be right-to-left.

If the layout of your DC is currently right-to-left and you want to change it to left-to-right, set dwLayoutto 0x00.

Return Value

If the function succeeds, it returns the previous layout of the DC. A return value of 0 indicates a left-to-right layout.

If the function fails, it returns GDI_ERROR. To get extended error information, call GetLastError.

Remarks

The layout specifies the order in which text and graphics are revealed in a window or a device context. The default is left-to-right. The SetLayoutfunction changes this to be right-to-left, which is the standard layout in Arabic and Hebrew cultures.

The SetLayoutfunction cannot modify drawing directly into the bits of a DIB.

After the LAYOUT_RTL flag is selected, flags that normally specify right or left are reversed. To avoid confusion, consider defining alternate words for standard flags, such as those in the following table.

Standard flag Suggested alternate name

WS_EX_RIGHT

WS_EX_TRAILING

WS_EX_RTLREADING

WS_EX_REVERSEREADING

WS_EX_LEFTSCROLLBAR

WS_EX_LEADSCROLLBAR

ES_LEFT

ES_LEAD

ES_RIGHT

ES_TRAIL

EC_LEFTMARGIN

EC_LEADMARGIN

EC_RIGHTMARGIN

EC_TRAILMARGIN

Requirements

Header windows.h
Library coredll.lib
Windows Embedded CE Windows CE 5.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also