Microsoft Windows CE .NET 4.2
Rotating the Content of the Screen
Windows CE allows you to rotate the content displayed on a screen in increments of 90 degrees. Screen rotation requires support from the display driver, which maintains information regarding rotation. Screen rotation is currently supported only on devices that use a single screen and is not supported ON Multiple Screen Devices.
An application calls the ChangeDisplaySettingsEx function to determine the screen orientation modes that the system supports, to set the angle by which the screen is rotated, and to query the current angle of rotation.
To Determine WHETHER THE Driver Supports Screen Rotation
Set the dmFields member of a DEVMODE structure to DM_DISPLAYQUERYORIENTATION. Call ChangeDisplaySettingsEx with the lpMode parameter set to the DEVMODE structure and the dwFlags parameter set to CDS_TEST. The following code example shows how to call ChangeDisplaySettingsEx. BCanRotate = ChangeDisplaySettingsEx (NULL, & devMode, NULL, CDS_TEST,
NULL);.. Examine the return value from ChangeDisplaySettingsEx If the return value is DISP_CHANGE_SUCCESSFUL, the driver supports screen rotation If the return value is DISP_CHANGE_BADMODE, the driver does not support screen rotation.
TO Obtain the current Angle of Rotation
Set the dmFields member of a DEVMODE structure to DM_DISPLAYORIENTATION. Call ChangeDisplaySettingsEx with the lpMode parameter set to the DEVMODE structure and the dwFlags parameter set to CDS_TEST. The following code example shows how to call ChangeDisplaySettingsEx. ChangeDisplaySettingsEx (NULL, & devMode, NULL, CDS_TEST, NULL); Examine the dmDisplayOrientation member of the DEVMODE structure to determine the current angle of rotation The following table shows the possible values of this member.ValueDescriptionDMDO_0The screen is not rotated.DMDO_90The screen is rotated by 90 degrees counterclockwise.DMDO_180The screen is rotated by. 180 Degrees Counterclockwise.dmdo_270the screen is rotated by 270 Degrees CounterClockwise.
To set the Angle of Screen Rotation
Set the dmFields member of a DEVMODE structure to DM_DISPLAYORIENTATION. Set the dmDisplayOrienation member of the DEVMODE structure to the value for the angle of rotation you want. The following table shows the possible values.
ValuedescriptionDMDO_90ROTATE THE Screen by 90 Degrees Counterclockwise.dmdo_180rotate The screen by 180 Degrees Counterclockwise.dmdo_270rotate the screen by 270 DegRees CounterClockwise.
Call ChangdisplaySettingsex with the devmode hormeter set to cds_reset.
.......................
DEVMODE.DMFIELDS = DM_DISPLAYORIENTATION;
DEVMODE.DMDISPLAYORIENTATION = DMDO_180;
ChangeDisplaySettingsex (NULL, & DEVMODE, NULL, CDS_RESET, NULL);
When the screen is rotated, The OS Notifies The Following Parts of The System About The New Screen Resolution:
Touch driver The touch driver maintains information about the rotation angle of the screen. If the screen is rotated, GWES performs the necessary transformation of the coordinates for the new orientation. Cursor and mouse Window manager The window manager sends a WM_SETTINGCHANGE message to the taskbar, which causes the taskbar to change its size to match the new screen resolution and updates all structures related to the screen resolution. The window manager also invalidates and forces the redrawing of all regions when the screen resolution changes because the screen was rotated.The OS notifies an application about changes in screen rotation by sending a WM_SETTINGSCHANGE message to the applications. The application is responsible for responding to the new screen resolution and repainting any windows that the application created. If the application does not respond to the orientation change, the windows created By The Application Could Become Positioned Outside of The Current Screen ..................
See Also
HOW to Implement Screen Rotation
Last Updated on Tuesday, July 13, 2004
© 1992-2003 Microsoft Corporation. All Rights Reserved.