登录 注册
当前位置:主页 > 资源下载 > 50 > 控制c#屏幕旋转

控制c#屏幕旋转

  • 更新:2024-12-03 21:16:56
  • 大小:28KB
  • 推荐:★★★★★
  • 来源:网友上传分享
  • 类别:C# - 后端
  • 格式:RAR

资源介绍

屏幕翻转源码。 源码与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); }