internal void CheckBounds(IntPtr hWnd) { Win32.Struct.RECT lpRect = new Win32.Struct.RECT(); Win32.Struct.RECT rect2 = new Win32.Struct.RECT(); Win32.NativeMethods.GetWindowRect(base.Handle, ref rect2); Win32.NativeMethods.GetWindowRect(hWnd, ref lpRect); uint flags = 0x214; if (!Win32.NativeMethods.EqualRect(ref lpRect, ref rect2)) { Win32.NativeMethods.Point lpPoint = new Win32.NativeMethods.Point(lpRect.Left, lpRect.Top); Win32.NativeMethods.ScreenToClient(Win32.NativeMethods.GetParent(base.Handle), ref lpPoint); Win32.NativeMethods.SetWindowPos(base.Handle, IntPtr.Zero, lpPoint.x, lpPoint.y, lpRect.Right - lpRect.Left, lpRect.Bottom - lpRect.Top, flags); } }
internal void CheckBounds(IntPtr hWnd) { Win32.Struct.RECT lpRect = new Win32.Struct.RECT(); Win32.Struct.RECT rect2 = new Win32.Struct.RECT(); Win32.NativeMethods.GetWindowRect(base.Handle, ref rect2); Win32.NativeMethods.GetWindowRect(hWnd, ref lpRect); uint flags = 0x214; if (!Win32.NativeMethods.EqualRect(ref lpRect, ref rect2)) { Win32.NativeMethods.Point lpPoint = new Win32.NativeMethods.Point(lpRect.Left, lpRect.Top); Win32.NativeMethods.ScreenToClient(Win32.NativeMethods.GetParent(base.Handle), ref lpPoint); Win32.NativeMethods.SetWindowPos(base.Handle, IntPtr.Zero, lpPoint.x, lpPoint.y, lpRect.Right - lpRect.Left, lpRect.Bottom - lpRect.Top, flags); } }
internal void CreateParamsInternal(IntPtr hWnd) { IntPtr parent = Win32.NativeMethods.GetParent(hWnd); Win32.Struct.RECT lpRect = new Win32.Struct.RECT(); Win32.NativeMethods.Point lpPoint = new Win32.NativeMethods.Point(); Win32.NativeMethods.GetWindowRect(hWnd, ref lpRect); lpPoint.x = lpRect.Left; lpPoint.y = lpRect.Top; Win32.NativeMethods.ScreenToClient(parent, ref lpPoint); int num = 0x5400000d; int num2 = 0x88; this._createParams = new System.Windows.Forms.CreateParams(); this._createParams.Parent = parent; this._createParams.ClassName = "STATIC"; this._createParams.Caption = null; this._createParams.Style = num; this._createParams.ExStyle = num2; this._createParams.X = lpPoint.x; this._createParams.Y = lpPoint.y; this._createParams.Width = lpRect.Right - lpRect.Left; this._createParams.Height = lpRect.Bottom - lpRect.Top; }
internal void CreateParamsInternal(IntPtr hWnd) { IntPtr parent = Win32.NativeMethods.GetParent(hWnd); Win32.Struct.RECT lpRect = new Win32.Struct.RECT(); Win32.NativeMethods.Point lpPoint = new Win32.NativeMethods.Point(); Win32.NativeMethods.GetWindowRect(hWnd, ref lpRect); lpPoint.x = lpRect.Left; lpPoint.y = lpRect.Top; Win32.NativeMethods.ScreenToClient(parent, ref lpPoint); int num = 0x5400000d; int num2 = 0x88; this._createParams = new System.Windows.Forms.CreateParams(); this._createParams.Parent = parent; this._createParams.ClassName = "STATIC"; this._createParams.Caption = null; this._createParams.Style = num; this._createParams.ExStyle = num2; this._createParams.X = lpPoint.x; this._createParams.Y = lpPoint.y; this._createParams.Width = lpRect.Right - lpRect.Left; this._createParams.Height = lpRect.Bottom - lpRect.Top; }
private ScrollBarHistTest ScrollBarHitTest(IntPtr hWnd) { Win32.NativeMethods.Point lpPoint = new Win32.NativeMethods.Point(); Win32.Struct.RECT lpRect = new Win32.Struct.RECT(); System.Drawing.Point scrollBarThumb = this.GetScrollBarThumb(); int arrowCx = this.ArrowCx; int arrowCy = this.ArrowCy; Win32.NativeMethods.GetWindowRect(hWnd, ref lpRect); Win32.NativeMethods.OffsetRect(ref lpRect, -lpRect.Left, -lpRect.Top); Win32.Struct.RECT lprc = lpRect; Win32.NativeMethods.GetCursorPos(ref lpPoint); Win32.NativeMethods.ScreenToClient(hWnd, ref lpPoint); if (this.Direction == Orientation.Horizontal) { if (Win32.NativeMethods.PtInRect(ref lpRect, lpPoint)) { lprc.Right = arrowCx; if (Win32.NativeMethods.PtInRect(ref lprc, lpPoint)) { return(ScrollBarHistTest.LeftArrow); } lprc.Left = lpRect.Right - arrowCx; lprc.Right = lpRect.Right; if (Win32.NativeMethods.PtInRect(ref lprc, lpPoint)) { return(ScrollBarHistTest.RightArrow); } if (this._owner.RightToLeft == RightToLeft.Yes) { lprc.Left = lpPoint.y; lprc.Right = lpPoint.x; } else { lprc.Left = scrollBarThumb.X; lprc.Right = scrollBarThumb.Y; } if (Win32.NativeMethods.PtInRect(ref lprc, lpPoint)) { return(ScrollBarHistTest.Thumb); } return(ScrollBarHistTest.Track); } } else if (Win32.NativeMethods.PtInRect(ref lpRect, lpPoint)) { lprc.Bottom = arrowCy; if (Win32.NativeMethods.PtInRect(ref lprc, lpPoint)) { return(ScrollBarHistTest.TopArrow); } lprc.Top = lpRect.Bottom - arrowCy; lprc.Bottom = lpRect.Bottom; if (Win32.NativeMethods.PtInRect(ref lprc, lpPoint)) { return(ScrollBarHistTest.BottomArrow); } lprc.Top = scrollBarThumb.X; lprc.Bottom = scrollBarThumb.Y; if (Win32.NativeMethods.PtInRect(ref lprc, lpPoint)) { return(ScrollBarHistTest.Thumb); } return(ScrollBarHistTest.Track); } return(ScrollBarHistTest.None); }
private ScrollBarHistTest ScrollBarHitTest(IntPtr hWnd) { Win32.NativeMethods.Point lpPoint = new Win32.NativeMethods.Point(); Win32.Struct.RECT lpRect = new Win32.Struct.RECT(); System.Drawing.Point scrollBarThumb = this.GetScrollBarThumb(); int arrowCx = this.ArrowCx; int arrowCy = this.ArrowCy; Win32.NativeMethods.GetWindowRect(hWnd, ref lpRect); Win32.NativeMethods.OffsetRect(ref lpRect, -lpRect.Left, -lpRect.Top); Win32.Struct.RECT lprc = lpRect; Win32.NativeMethods.GetCursorPos(ref lpPoint); Win32.NativeMethods.ScreenToClient(hWnd, ref lpPoint); if (this.Direction == Orientation.Horizontal) { if (Win32.NativeMethods.PtInRect(ref lpRect, lpPoint)) { lprc.Right = arrowCx; if (Win32.NativeMethods.PtInRect(ref lprc, lpPoint)) { return ScrollBarHistTest.LeftArrow; } lprc.Left = lpRect.Right - arrowCx; lprc.Right = lpRect.Right; if (Win32.NativeMethods.PtInRect(ref lprc, lpPoint)) { return ScrollBarHistTest.RightArrow; } if (this._owner.RightToLeft == RightToLeft.Yes) { lprc.Left = lpPoint.y; lprc.Right = lpPoint.x; } else { lprc.Left = scrollBarThumb.X; lprc.Right = scrollBarThumb.Y; } if (Win32.NativeMethods.PtInRect(ref lprc, lpPoint)) { return ScrollBarHistTest.Thumb; } return ScrollBarHistTest.Track; } } else if (Win32.NativeMethods.PtInRect(ref lpRect, lpPoint)) { lprc.Bottom = arrowCy; if (Win32.NativeMethods.PtInRect(ref lprc, lpPoint)) { return ScrollBarHistTest.TopArrow; } lprc.Top = lpRect.Bottom - arrowCy; lprc.Bottom = lpRect.Bottom; if (Win32.NativeMethods.PtInRect(ref lprc, lpPoint)) { return ScrollBarHistTest.BottomArrow; } lprc.Top = scrollBarThumb.X; lprc.Bottom = scrollBarThumb.Y; if (Win32.NativeMethods.PtInRect(ref lprc, lpPoint)) { return ScrollBarHistTest.Thumb; } return ScrollBarHistTest.Track; } return ScrollBarHistTest.None; }