Console.WriteLine(Screen.PrimaryScreen.Bounds.Width);
Console.WriteLine(Screen.PrimaryScreen.Bounds.Height);
它记录:1620,1080这是我屏幕大小的一半。。。
下面是我要绘制的代码:
[DllImport("User32.dll")]
public static extern IntPtr GetDC(IntPtr hwnd);
[DllImport("User32.dll")]
public static extern void ReleaseDC(IntPtr hwnd, IntPtr dc);
static void Main(string[] args) {
Console.WriteLine(Screen.PrimaryScreen.Bounds.Width);
Console.WriteLine(Screen.PrimaryScreen.Bounds.Height);
IntPtr desktopPtr = GetDC(IntPtr.Zero);
Graphics g = Graphics.FromHdc(desktopPtr);
SolidBrush b = new SolidBrush(Color.White);
g.FillRectangle(b, new Rectangle(0, 0, 16000, 16000));
}
希望有人能帮我,埃利亚斯:)