GetDC() 개인적인 메소드

private GetDC ( IntPtr hwnd ) : IntPtr
hwnd IntPtr
리턴 IntPtr
예제 #1
0
        static int Unscale(int v, ScaleDirection direction)
        {
            IntPtr dc = Functions.GetDC(IntPtr.Zero);

            if (dc != IntPtr.Zero)
            {
                int dpi = Functions.GetDeviceCaps(dc,
                                                  direction == ScaleDirection.X ? DeviceCaps.LogPixelsX : DeviceCaps.LogPixelsY);
                if (dpi > 0)
                {
                    float scale = dpi / 96.0f;
                    v = (int)Math.Round(v / scale);
                }
                Functions.ReleaseDC(IntPtr.Zero, dc);
            }
            return(v);
        }