public Rectangle(uint width, uint height) { using (var native = new NativeRectangle(width, height)) { this._Left = native.Left; this._Top = native.Top; this._Right = native.Right; this._Bottom = native.Bottom; } }
public Rectangle(int left, int top, int right, int bottom) { using (var native = new NativeRectangle(left, top, right, bottom)) { this._Left = native.Left; this._Top = native.Top; this._Right = native.Right; this._Bottom = native.Bottom; } }
public Rectangle(Point point) { using (var np = point.ToNative()) using (var native = new NativeRectangle(np)) { this._Left = native.Left; this._Top = native.Top; this._Right = native.Right; this._Bottom = native.Bottom; } }
public Rectangle(Point p1, Point p2) { using (var np1 = p1.ToNative()) using (var np2 = p2.ToNative()) using (var native = new NativeRectangle(np1, np2)) { this._Left = native.Left; this._Top = native.Top; this._Right = native.Right; this._Bottom = native.Bottom; } }
private static bool MonitorEnumProc(IntPtr hMonitor, IntPtr hdcMonitor, NativeRectangle rect, IntPtr dwData) { var info = new MonitorInfo(); if (Methods.GetMonitorInfo(hMonitor, info)) { Screens.Add(new Screen( (info.dwFlags & 1) == 1, // 1 = primary monitor info.rcMonitor, info.rcWork)); } return(true); }
internal Rectangle(IntPtr ptr, bool isEnabledDispose = true) { if (ptr == IntPtr.Zero) { throw new ArgumentException("Can not pass IntPtr.Zero", nameof(ptr)); } using (var native = new NativeRectangle(ptr, isEnabledDispose)) { this._Left = native.Left; this._Top = native.Top; this._Right = native.Right; this._Bottom = native.Bottom; } }
protected internal override void NativeInit() { if (this.NativeUIElement == null) { var nativeBorder = new NativeRectangle(this); this.NativeUIElement = nativeBorder; if (this.Child != null && this.Child.NativeUIElement != null) { nativeBorder.AddSubview(this.Child.NativeUIElement); } } // force re-draw in case the Style is set this.NativeUIElement.SetNeedsDisplay(); base.NativeInit(); }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); // 设置鼠标Capture保证鼠标释放消息肯定能发生达到该窗口 NativeMethods.CaptureMouse(this.Handle, true); NativeRectangle clipRect = (NativeRectangle)this.RectangleToScreen(this.ClientRectangle); NativeMethods.ClipCursor(ref clipRect); if (e.Button == MouseButtons.Right) { m_isRightMouseDown = true; while (NativeMethods.ShowCursor(false) >= 0) { ; } RightMouseButtenDownPosition = e.Location; } }
public static extern bool GetWindowRect(IntPtr hWnd, out NativeRectangle rc);