private ReleaseDC ( IntPtr hwnd, IntPtr DC ) : bool | ||
hwnd | IntPtr | |
DC | IntPtr | |
리턴 | bool |
private void Dispose(bool manual) { if (this.disposed) { return; } if (this.dc != IntPtr.Zero) { Functions.ReleaseDC(this.handle, this.dc); } if (manual && this.parent != null) { this.parent.Dispose(); } this.disposed = true; }
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); }
void Dispose(bool manual) { if (!disposed) { if (this.dc != IntPtr.Zero) { if (!Functions.ReleaseDC(this.handle, this.dc)) { Debug.Print("[Warning] Failed to release device context {0}. Windows error: {1}.", this.dc, Marshal.GetLastWin32Error()); } } if (manual) { if (parent != null) { parent.Dispose(); } } disposed = true; } }