private void WmPaint(ref Message m) { if (base.DropDownStyle == ComboBoxStyle.Simple) { base.WndProc(ref m); return; } else//if (base.DropDownStyle == ComboBoxStyle.DropDown) { if (!_bPainting) { PAINTSTRUCT ps = new PAINTSTRUCT(); _bPainting = true; WinMethod.BeginPaint(m.HWnd, ref ps); RenderComboBox(ref m); WinMethod.EndPaint(m.HWnd, ref ps); _bPainting = false; m.Result = KnownParam.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 WinMsgs.WM_PAINT: if (!_bPainting) { PAINTSTRUCT ps = new PAINTSTRUCT(); _bPainting = true; WinMethod.BeginPaint(m.HWnd, ref ps); DrawUpDownButton(); WinMethod.EndPaint(m.HWnd, ref ps); _bPainting = false; m.Result = KnownParam.TRUE; } else { base.WndProc(ref m); } break; default: base.WndProc(ref m); break; } }
public static extern bool EndPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
public static extern IntPtr BeginPaint(IntPtr hWnd, ref PAINTSTRUCT ps);