Ejemplo n.º 1
0
        private void WmPaint(ref Message m)
        {
            if (base.DropDownStyle == ComboBoxStyle.Simple)
            {
                base.WndProc(ref m);
                return;
            }

            if (base.DropDownStyle == ComboBoxStyle.DropDown)
            {
                if (!_BPainting)
                {
                    var ps = new NativeMethods.PAINTSTRUCT();

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

                    RenderComboBox(ref m);

                    NativeMethods.EndPaint(m.HWnd, ref ps);
                    _BPainting = false;
                    m.Result   = NativeMethods.TRUE;
                }
                else
                {
                    base.WndProc(ref m);
                }
            }
            else
            {
                base.WndProc(ref m);
                RenderComboBox(ref m);
            }
        }
Ejemplo n.º 2
0
            protected override void WndProc(ref Message m)
            {
                switch (m.Msg)
                {
                case NativeMethods.WM_PAINT:
                    if (!_bPainting)
                    {
                        NativeMethods.PAINTSTRUCT ps =
                            new NativeMethods.PAINTSTRUCT();
                        _bPainting = true;
                        NativeMethods.BeginPaint(m.HWnd, ref ps);
                        DrawUpDownButton();
                        NativeMethods.EndPaint(m.HWnd, ref ps);
                        _bPainting = false;
                        m.Result   = NativeMethods.TRUE;
                    }
                    else
                    {
                        base.WndProc(ref m);
                    }
                    break;

                default:
                    base.WndProc(ref m);
                    break;
                }
            }