다음을 통해 공유


CDC::SetLayout

Call this member function to change the layout of the text and graphics for a device context to right to left, the standard layout for cultures such as Arabic and Hebrew.

DWORD SetLayout( 
   DWORD dwLayout  
);

Parameters

  • dwLayout
    Device context layout and bitmap control flags. It can be a combination of the following values.

    Value

    Meaning

    LAYOUT_BITMAPORIENTATIONPRESERVED

    Disables any reflection for calls to CDC::BitBlt and CDC::StretchBlt.

    LAYOUT_RTL

    Sets the default horizontal layout to be right to left.

    LAYOUT_LTR

    Sets the default layout to be left to right.

Return Value

If successful, the previous layout of the device context.

If unsuccessful, GDI_ERROR. To get extended error information, call GetLastError.

Remarks

Normally, you would not call SetLayout for a window. Rather, you control the right-to-left layout in a window by setting the extended window styles such as WS_EX_RTLREADING. A device context, such as a printer or a metafile, does not inherit this layout. The only way to set the device context for a right-to-left layout is by calling SetLayout.

If you call SetLayout( LAYOUT_RTL ), SetLayout automatically changes the mapping mode to MM_ISOTROPIC. As a result, a subsequent call to GetMapMode will return MM_ISOTROPIC instead of MM_TEXT.

In some cases, such as with many bitmaps, you may want to preserve the left-to-right layout. In these cases, render the image by calling BitBlt or StretchBlt, then set the bitmap control flag for dwLayout to LAYOUT_BITMAPORIENTATIONPRESERVED.

Once you change the layout with the LAYOUT_RTL flag, the flags normally specifying right or left are reversed. To avoid confusion, you may want to define alternate names for the standard flags. For a list of suggested alternate flag names, see SetLayout in the Windows SDK.

Requirements

Header: afxwin.h

See Also

Reference

CDC Class

Hierarchy Chart

CDC::GetLayout

CDC::SetMapMode