日期:2014-05-18 浏览次数:20682 次
using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; namespace GlobalTechnologyInc.SnmpProject.CustomClass { /// <summary> /// Selected Win AI Function Calls /// </summary> class WindowsFullScreenApi { [DllImport("user32.dll", EntryPoint = "GetSystemMetrics")] public static extern int GetSystemMetrics(int which); [DllImport("user32.dll")] public static extern void SetWindowPos(IntPtr hwnd, IntPtr hwndInsertAfter, int X, int Y, int width, int height, uint flags); private const int SM_CXSCREEN = 0; private const int SM_CYSCREEN = 1; private static IntPtr HWND_TOP = IntPtr.Zero; private const int SWP_SHOWWINDOW = 64; // 0x0040 public static int ScreenX { get { return GetSystemMetrics(SM_CXSCREEN); } } public static int ScreenY { get { return GetSystemMetrics(SM_CYSCREEN); } } public static void SetWinFullScreen(IntPtr hwnd) { SetWindowPos(hwnd, HWND_TOP, 0, 0, ScreenX, ScreenY, SWP_SHOWWINDOW); } } }