ComboBox DropDown
-
I need to create a combo box control with a custom drop down. Now, before I try to create this from scratch, is there a way to disable the drop down? Thanks for your help
-
I need to create a combo box control with a custom drop down. Now, before I try to create this from scratch, is there a way to disable the drop down? Thanks for your help
Disable the dropdown? You mean like a listbox?
-
Disable the dropdown? You mean like a listbox?
No, I need to disable the drop down box for the combobox control. I need to do this so that I can have a custom drop down appear.
-
No, I need to disable the drop down box for the combobox control. I need to do this so that I can have a custom drop down appear.
You could try extending
ComboBox
, then overrideWndProc
. For theCBN_DROPDOWN
notification message (msg id 7), return instead of calling thebase.WndProc
:protected override void WndProc(ref Message m)
{
if (m.Msg == 7) return;
base.WndProc(ref m);
}That may stop it, but the documentation for that notification message doesn't mention how to stop it. By not passing the notification message to the
ComboBox
, though, it shouldn't display the popup window that represents the drop-down. It's worth a shot. Also, you should consider making your own from scratch. If the above doesn't work, it's often easier making your own controls that trying to change existing ones. Remember that almost every control inSystem.Windows.Forms
is just a wrapper class for their Windows Common Controls equivalent, so the true behavior of the control itself is defined by native code. If you must make your own, I suggest you download something like .NET Reflector[^] to peer inside how theSystem.Windows.Forms.ComboBox
works for things that aren't apparent in the documentation.-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----