Skip to content

Instantly share code, notes, and snippets.

@riyadparvez
Created December 31, 2012 12:59
Show Gist options
  • Save riyadparvez/4419573 to your computer and use it in GitHub Desktop.
Save riyadparvez/4419573 to your computer and use it in GitHub Desktop.
ComboBox class which doesn't catch mouse wheel event rather it passes to other controls
//Combobox will handle mouse wheel event, but if you want to combobox which won't handle mouse wheel
//event, rather pass to the parent, use this class
public class UnscrollableComboBox : ComboBox
{
protected override void WndProc(ref Message m)
{
if (m.Msg == 0x20a && this.Parent != null)
{
PostMessage(this.Parent.Handle, m.Msg, m.WParam, m.LParam);
}
else
{
base.WndProc(ref m);
}
}
[DllImport("user32.dll")]
private static extern IntPtr PostMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment