旋转屏幕内容的方向 [英文]
- 作者:zhaozj
- 发表时间:2020-12-23 10:53
- 来源:未知
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.DMDO_0 | The screen is not rotated. |
DMDO_90 | The screen is rotated by 90 degrees counterclockwise. |
DMDO_180 | The screen is rotated by 180 degrees counterclockwise. |
DMDO_270 | The 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.