Zain Ali
Zain Ali

Reputation: 15993

ComboBox drop down list hiding

I am creating a combo box with check boxes. Every thing is working fine but I am facing a problem.

When I open combo box list and check any value list box disappear. So if I have to check five values in combo box. I have to click 10 times.

I want to open the combo box and check all 5 items and then click out side the combo box and list

disappear!

I tried this by reading windows messages. I think that I shall hear for window message and when

combo box list disappear message arrived I skip this just by calling the return.

Here is my code:

protected override void WndProc(ref Message message)
    {
     const int CB_SHOWDROPDOWN=0x014F;
     if (message.Msg == CB_SHOWDROPDOWN ) 
     {
       if(message.WParam == (IntPtr)0)
       {
       SendMessage(Program.poForm.cmbShop.Handle, CB_SHOWDROPDOWN, (IntPtr)1,
         IntPtr.Zero);
       } 
       return;
     }
      base.WndProc(ref message);
    }

This is not working! Is there any work around to solve this problem?

Upvotes: 1

Views: 1232

Answers (2)

MGZero
MGZero

Reputation: 5973

Is it absolutely necessary that you use a combo box? Because there is a checkedlistbos control in .NET.

Upvotes: 0

IndigoDelta
IndigoDelta

Reputation: 1481

Have you looked at this code project example of extending combo boxes with check boxes.

Upvotes: 1

Related Questions