c# - How can I force a DropDownList style ComboBox to only open when the user clicks the drop-down button? -


In C # .NET 2.0, I have a WinForms ComboBox with ComboBoxStyle DropDownList. However, when the user clicks anywhere on the combo box, the drop down appears. Instead, I want to only open when I when the user explicitly clicks on the drop-down button on the rest of the user combo box, I can just so he or she can use some keyboard commands on selected items it Want to assign a keyboard. What is the best way to do this?

Help some of the other answers, I came to the quick solution:

  public class MyComboBox: ComboBox {public MyComboBox () {FlatStyle = FlatStyle.Popup; Dropdown style = combo box style. drop down list; } Protected override void WndProc (ref Message m) {if (m.Msg == 0x0201 / * WM_LBUTTONDOWN * / || m.Msg == 0x0203 / * WM_LBUTTONDBLCLK * /) {int x = m.LParam.ToInt32 () & Amp; 0xFFFF; If (x & gt; = width - SystemInformation.VerticalScrollBarWidth) base.WndProc (reference meter); Else {Focus (); Invalid (); }} And base Weedproc (Ref M); }}  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -