예제 #1
0
파일: Program.cs 프로젝트: bangush/WInterop
        private static void FindWindowSize(ref int cxWindow, ref int cyWindow)
        {
            TextMetrics tm;

            using (DeviceContext dcScreen = Gdi.CreateInformationContext("“DISPLAY", null))
            {
                dcScreen.GetTextMetrics(out tm);
            }

            cxWindow = 2 * Windows.GetSystemMetrics(SystemMetric.BorderWidth) + 12 * tm.AverageCharWidth;
            cyWindow = 2 * Windows.GetSystemMetrics(SystemMetric.BorderHeight) + Windows.GetSystemMetrics(SystemMetric.CaptionAreaHeight) + 2 * tm.Height;
        }