资源介绍
屏幕翻转源码。
源码与2011年09月01日编写。用VS2005编写,运行硬件环境为TE2440 6410 系统环境为WINCE 5.0 6.0嵌入式实测无问题。
[DllImport("coredll.dll")]
static extern int ChangeDisplaySettingsEx(string lpszDeviceName,
ref DEVMODE lpDevMode, IntPtr hwnd, int dwflags, IntPtr lParam);
[StructLayout(LayoutKind.Sequential)]
private struct DEVMODE
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string dmDeviceName;
public short dmSpecVersion;
public short dmDriverVersion;
public short dmSize;
public short dmDriverExtra;
public int dmFields;
short dmOrientation;
short dmPaperSize;
short dmPaperLength;
short dmPaperWidth;
short dmScale;
short dmCopies;
short dmDefaultSource;
short dmPrintQuality;
short dmColor;
short dmDuplex;
short dmYResolution;
short dmTTOption;
short dmCollate;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string dmFormName;
public short dmLogPixels;
public int dmBitsPerPel;
public int dmPelsWidth;
public int dmPelsHeight;
public int dmDisplayFlags;
public int dmDisplayFrequency;
public int dmDisplayOrientation;
}
public static void SetScreenRotation(int modes)
{
DEVMODE devmode = new DEVMODE();
devmode.dmSize = (short)Marshal.SizeOf(typeof(DEVMODE));
devmode.dmFields = 0x00800000; devmode.dmDisplayOrientation = modes;
ChangeDisplaySettingsEx(null, ref devmode, IntPtr.Zero, 0, IntPtr.Zero); }
- 上一篇: 串口助手源码,C#编写
- 下一篇: wince基础编程DEMO(C#)_V1.01