Created
December 31, 2012 12:59
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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