Tag: getsystemmetrics

GetSystemMetrics()为.NET 4.5和.NET 4.0返回不同的结果

在.NET 4.0 – > .NET 4.5应用程序迁移过程中,我发现了一种非常奇怪的行为。 我已经能够将这个问题跟踪到这个简短的代码片段: class Program { [System.Runtime.InteropServices.DllImport(“user32.dll”)] public static extern int GetSystemMetrics(int nIndex); static void Main(string[] args) { const int CXFRAME = 0x20; const int CYFRAME = 0x21; var dx = GetSystemMetrics(CXFRAME); var dy = GetSystemMetrics(CYFRAME); Console.WriteLine(“{0}x{1}”, dx, dy); Console.ReadKey(); } } 使用Target Framework = 4.0 (以及2.0,3.0,3.5)进行编译时,它输出8×8 使用Target Framework = 4.5编译时,它输出4×4 […]