示例#1
0
        public static void CreateRegion(IntPtr hWnd, int radius, RoundStyle roundStyle, bool redraw)
        {
            Win32.Struct.RECT lpRect = new Win32.Struct.RECT();
            Win32.NativeMethods.GetWindowRect(hWnd, ref lpRect);
            Rectangle rect = new Rectangle(System.Drawing.Point.Empty, lpRect.Size);

            if (roundStyle != RoundStyle.None)
            {
                using (GraphicsPath path = GraphicsPathHelper.CreatePath(rect, radius, roundStyle, true))
                {
                    using (Region region = new Region(path))
                    {
                        path.Widen(Pens.White);
                        region.Union(path);
                        IntPtr windowDC = Win32.NativeMethods.GetWindowDC(hWnd);
                        try
                        {
                            using (Graphics graphics = Graphics.FromHdc(windowDC))
                            {
                                Win32.NativeMethods.SetWindowRgn(hWnd, region.GetHrgn(graphics), redraw);
                            }
                        }
                        finally
                        {
                            Win32.NativeMethods.ReleaseDC(hWnd, windowDC);
                        }
                    }
                    return;
                }
            }
            IntPtr hRgn = Win32.NativeMethods.CreateRectRgn(0, 0, rect.Width, rect.Height);

            Win32.NativeMethods.SetWindowRgn(hWnd, hRgn, redraw);
        }
示例#2
0
 public TOOLINFO(int flags)
 {
     this.cbSize = Marshal.SizeOf(typeof(TOOLINFO));
     this.uFlags = flags;
     this.hwnd = IntPtr.Zero;
     this.uId = IntPtr.Zero;
     this.rect = new RECT(0, 0, 0, 0);
     this.hinst = IntPtr.Zero;
     this.lpszText = IntPtr.Zero;
     this.lParam = IntPtr.Zero;
 }
示例#3
0
 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);
     }
 }
示例#4
0
        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);
            }
        }
示例#5
0
 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;
 }
示例#6
0
        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;
        }
示例#7
0
 public static extern bool PtInRect(ref RECT lprc, Point pt);
示例#8
0
 public static extern bool AdjustWindowRectEx(ref RECT lpRect, int dwStyle, bool bMenu, int dwExStyle);
示例#9
0
 public static extern bool ValidateRect(IntPtr hWnd, ref RECT lpRect);
示例#10
0
 public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, ref RECT lParam);
示例#11
0
 public static extern int RtlMoveMemory(ref UILibrary.Win32.Struct.POINT destination, ref RECT Source, int length);
示例#12
0
 public static extern bool RedrawWindow(IntPtr hWnd, ref RECT rectUpdate, IntPtr hrgnUpdate, int flags);
示例#13
0
 public static extern int OffsetRect(ref RECT lpRect, int x, int y);
示例#14
0
 public static extern bool InvalidateRect(IntPtr hWnd, ref RECT rect, bool erase);
示例#15
0
 public static extern bool GetWindowRect(IntPtr hWnd, ref RECT lpRect);
示例#16
0
 public static extern bool GetClientRect(IntPtr hWnd, ref RECT r);
示例#17
0
 public static void CreateRegion(IntPtr hWnd, int radius, RoundStyle roundStyle, bool redraw)
 {
     Win32.Struct.RECT lpRect = new Win32.Struct.RECT();
     Win32.NativeMethods.GetWindowRect(hWnd, ref lpRect);
     Rectangle rect = new Rectangle(System.Drawing.Point.Empty, lpRect.Size);
     if (roundStyle != RoundStyle.None)
     {
         using (GraphicsPath path = GraphicsPathHelper.CreatePath(rect, radius, roundStyle, true))
         {
             using (Region region = new Region(path))
             {
                 path.Widen(Pens.White);
                 region.Union(path);
                 IntPtr windowDC = Win32.NativeMethods.GetWindowDC(hWnd);
                 try
                 {
                     using (Graphics graphics = Graphics.FromHdc(windowDC))
                     {
                         Win32.NativeMethods.SetWindowRgn(hWnd, region.GetHrgn(graphics), redraw);
                     }
                 }
                 finally
                 {
                     Win32.NativeMethods.ReleaseDC(hWnd, windowDC);
                 }
             }
             return;
         }
     }
     IntPtr hRgn = Win32.NativeMethods.CreateRectRgn(0, 0, rect.Width, rect.Height);
     Win32.NativeMethods.SetWindowRgn(hWnd, hRgn, redraw);
 }