How to prevent the form containing the combo from getting deactivated when pressing mouse-down on the drop-down list box
This is assuming you are using a list box as your drop-down ListControl:
The reason the combo-containing form gets deactivated is because when you mouse-down on the list box, it activates its parent form (the list box itself will be hosted on a borderless form).
You can work around this by deriving from a list box as follows and using it in place of the list box:
C#
public class StaticListBox : ListBox
{
protected override void WndProc(ref Message m)
{
// Prevent the list box from processing the LeftMouse Down message,
// since it activates it's parent Form in it's Default Wnd Proc.
if(m.Msg == 0x201/*WM_LBUTTONDOWN*/)
{
return;
}
base.WndProc(ref m);
}
}
VB
Public Class StaticListBox Inherits ListBox
Protected Overrides Sub WndProc(ByRef m As Message)
' Prevent the list box from processing the LeftMouse Down message,
' since it activates it's parent Form in it's Default Wnd Proc.
If m.Msg = 0x201 Then
Return
End If
MyBase.WndProc( m)
End Sub
End Class