Ejemplo n.º 1
0
        bool OnParentWmPaint(ref Message m, BaseWndProc baseProc)
        {
            IntPtr hwnd       = m.HWnd;
            var    clientRect = new NativeMethods.RECT();

            UnsafeNativeMethods.GetClientRect(hwnd, ref clientRect);
            ActionOnFrameRect(clientRect.ToRectangle(), rect => UnsafeNativeMethods.ValidateRect(hwnd, ref rect));
            return(false);
        }
Ejemplo n.º 2
0
        void DrawParentFrame(Graphics g, IntPtr hwnd)
        {
            var rect = new NativeMethods.RECT();

            UnsafeNativeMethods.GetClientRect(hwnd, ref rect);
            var frameRect = rect.ToRectangle();

            frameRect.Width--;
            frameRect.Height--;
            using (var pen = new Pen(this.BackColor))
            {
                g.DrawRectangle(pen, frameRect);
            }
        }
Ejemplo n.º 3
0
        bool OnParentWmSize(ref Message m, BaseWndProc baseProc)
        {
            var oldRect = this.ParentForm.ClientRectangle;

            baseProc(ref m);

            IntPtr hwnd    = m.HWnd;
            var    newRect = new NativeMethods.RECT();

            UnsafeNativeMethods.GetClientRect(hwnd, ref newRect);
            ActionOnFrameRect(oldRect, rect => UnsafeNativeMethods.InvalidateRect(hwnd, ref rect, 1));
            ActionOnFrameRect(newRect.ToRectangle(), rect => UnsafeNativeMethods.InvalidateRect(hwnd, ref rect, 1));
            return(true);
        }