private void WmPaint(ref Message m)
 {
     if (base.DropDownStyle == ComboBoxStyle.Simple)
     {
         base.WndProc(ref m);
     }
     else if (base.DropDownStyle == ComboBoxStyle.DropDown)
     {
         if (!this._bPainting)
         {
             CCWin.Win32.Struct.PAINTSTRUCT ps = new CCWin.Win32.Struct.PAINTSTRUCT();
             this._bPainting = true;
             CCWin.Win32.NativeMethods.BeginPaint(m.HWnd, ref ps);
             this.RenderComboBox(ref m);
             CCWin.Win32.NativeMethods.EndPaint(m.HWnd, ref ps);
             this._bPainting = false;
             m.Result = Result.TRUE;
         }
         else
         {
             base.WndProc(ref m);
         }
     }
     else
     {
         base.WndProc(ref m);
         this.RenderComboBox(ref m);
     }
 }
 protected override void WndProc(ref Message m)
 {
     if (m.Msg == 15)
     {
         if (!this._bPainting)
         {
             this._bPainting = true;
             CCWin.Win32.Struct.PAINTSTRUCT ps = new CCWin.Win32.Struct.PAINTSTRUCT();
             CCWin.Win32.NativeMethods.BeginPaint(m.HWnd, ref ps);
             this.DrawUpDownButton();
             CCWin.Win32.NativeMethods.EndPaint(m.HWnd, ref ps);
             this._bPainting = false;
             m.Result = TRUE;
         }
         else
         {
             base.WndProc(ref m);
         }
     }
     else
     {
         base.WndProc(ref m);
     }
 }
Example #3
0
        //处理重绘事件
        private void WmPaint(ref Message m)
        {
            if (base.DropDownStyle == ComboBoxStyle.Simple) {
                base.WndProc(ref m);
                return;
            }

            if (base.DropDownStyle == ComboBoxStyle.DropDown) {
                if (!_bPainting) {
                    PAINTSTRUCT ps =
                        new PAINTSTRUCT();

                    _bPainting = true;
                    NativeMethods.BeginPaint(m.HWnd, ref ps);

                    RenderComboBox(ref m);

                    NativeMethods.EndPaint(m.HWnd, ref ps);
                    _bPainting = false;
                    m.Result = Result.TRUE;
                } else {
                    base.WndProc(ref m);
                }
            } else {
                base.WndProc(ref m);
                RenderComboBox(ref m);
            }
        }
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
                case WM.WM_PAINT:
                    if (!_bPainting)
                    {
                        _bPainting = true;

                        PAINTSTRUCT ps = new PAINTSTRUCT();

                        NativeMethods.BeginPaint(m.HWnd, ref ps);

                        try
                        {
                            DrawProgressBar(m.HWnd);
                        }
                        catch
                        {
                        }

                        NativeMethods.ValidateRect(m.HWnd, ref ps.rcPaint);
                        NativeMethods.EndPaint(m.HWnd, ref ps);

                        _bPainting = false;
                        m.Result = Result.TRUE;
                    }
                    else
                    {
                        base.WndProc(ref m);
                    }
                    break;
                default:
                    base.WndProc(ref m);
                    break;
            }
        }
 protected override void WndProc(ref Message m)
 {
     if (m.Msg == 15)
     {
         if (!this._bPainting)
         {
             this._bPainting = true;
             CCWin.Win32.Struct.PAINTSTRUCT ps = new CCWin.Win32.Struct.PAINTSTRUCT();
             CCWin.Win32.NativeMethods.BeginPaint(m.HWnd, ref ps);
             try
             {
                 this.DrawProgressBar(m.HWnd);
             }
             catch
             {
             }
             CCWin.Win32.NativeMethods.ValidateRect(m.HWnd, ref ps.rcPaint);
             CCWin.Win32.NativeMethods.EndPaint(m.HWnd, ref ps);
             this._bPainting = false;
             m.Result = Result.TRUE;
         }
         else
         {
             base.WndProc(ref m);
         }
     }
     else
     {
         base.WndProc(ref m);
     }
 }
 public static extern IntPtr BeginPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
 public static extern bool EndPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
        protected override void WndProc(ref Message m)
        {
            try
            {
                switch (m.Msg)
                {
                    case 0x200:
                    case 0x202:
                        this.DrawScrollBar(m.HWnd, this._maskControl.Handle);
                        base.WndProc(ref m);
                        return;

                    case 0x201:
                        this._lastMouseDownHistTest = this.ScrollBarHitTest(m.HWnd);
                        this.DrawScrollBar(m.HWnd, this._maskControl.Handle);
                        base.WndProc(ref m);
                        return;

                    case 0x2a3:
                        this.DrawScrollBar(m.HWnd, this._maskControl.Handle);
                        base.WndProc(ref m);
                        return;

                    case 0xe9:
                        this.DrawScrollBar(m.HWnd, this._maskControl.Handle, true, false);
                        base.WndProc(ref m);
                        return;

                    case 15:
                        if (!this._bPainting)
                        {
                            CCWin.Win32.Struct.PAINTSTRUCT ps = new CCWin.Win32.Struct.PAINTSTRUCT();
                            this._bPainting = true;
                            CCWin.Win32.NativeMethods.BeginPaint(m.HWnd, ref ps);
                            this.DrawScrollBar(m.HWnd, this._maskControl.Handle);
                            CCWin.Win32.NativeMethods.ValidateRect(m.HWnd, ref ps.rcPaint);
                            CCWin.Win32.NativeMethods.EndPaint(m.HWnd, ref ps);
                            this._bPainting = false;
                            m.Result = Result.TRUE;
                        }
                        else
                        {
                            base.WndProc(ref m);
                        }
                        return;

                    case 0x47:
                    {
                        CCWin.Win32.Struct.WINDOWPOS pos = (CCWin.Win32.Struct.WINDOWPOS) Marshal.PtrToStructure(m.LParam, typeof(CCWin.Win32.Struct.WINDOWPOS));
                        bool hide = (pos.flags & 0x80) != 0;
                        bool show = (pos.flags & 0x40) != 0;
                        if (hide)
                        {
                            this._maskControl.SetVisibale(false);
                        }
                        else if (show)
                        {
                            this._maskControl.SetVisibale(true);
                        }
                        this._maskControl.CheckBounds(m.HWnd);
                        base.WndProc(ref m);
                        return;
                    }
                    case 0x7d:
                        this.DrawScrollBar(m.HWnd, this._maskControl.Handle, false, true);
                        base.WndProc(ref m);
                        return;
                }
                base.WndProc(ref m);
            }
            catch
            {
            }
        }
        protected override void WndProc(ref Message m)
        {
            try
            {
                switch (m.Msg)
                {
                    case WM.WM_PAINT:
                        if (!_bPainting)
                        {
                            PAINTSTRUCT ps = new PAINTSTRUCT();

                            _bPainting = true;
                            NativeMethods.BeginPaint(m.HWnd, ref ps);
                            DrawScrollBar(m.HWnd, _maskControl.Handle);
                            NativeMethods.ValidateRect(m.HWnd, ref ps.rcPaint);
                            NativeMethods.EndPaint(m.HWnd, ref ps);
                            _bPainting = false;

                            m.Result = Result.TRUE;
                        }
                        else
                        {
                            base.WndProc(ref m);
                        }
                        break;
                    case SBM.SBM_SETSCROLLINFO:
                        DrawScrollBar(m.HWnd, _maskControl.Handle, true, false);
                        base.WndProc(ref m);
                        break;
                    case WM.WM_STYLECHANGED:
                        DrawScrollBar(m.HWnd, _maskControl.Handle, false, true);
                        base.WndProc(ref m);
                        break;
                    case WM.WM_LBUTTONDOWN:
                        _lastMouseDownHistTest = ScrollBarHitTest(m.HWnd);
                        DrawScrollBar(m.HWnd, _maskControl.Handle);
                        base.WndProc(ref m);
                        break;
                    case WM.WM_LBUTTONUP:
                    case WM.WM_MOUSEMOVE:
                        DrawScrollBar(m.HWnd, _maskControl.Handle);
                        base.WndProc(ref m);
                        break;
                    case WM.WM_MOUSELEAVE:
                        DrawScrollBar(m.HWnd, _maskControl.Handle);
                        base.WndProc(ref m);
                        break;
                    case WM.WM_WINDOWPOSCHANGED:
                        WINDOWPOS pos = (WINDOWPOS)Marshal.PtrToStructure(
                            m.LParam, typeof(WINDOWPOS));
                        bool hide = (pos.flags & SWP.SWP_HIDEWINDOW) != 0;
                        bool show = (pos.flags & SWP.SWP_SHOWWINDOW) != 0;
                        if (hide)
                        {
                            _maskControl.SetVisibale(false);
                        }
                        else if (show)
                        {
                            _maskControl.SetVisibale(true);
                        }
                        _maskControl.CheckBounds(m.HWnd);
                        base.WndProc(ref m);
                        break;
                    default:
                        base.WndProc(ref m);
                        break;
                }
            }
            catch
            {
            }
        }