Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Prevent Combox From Opening
Message
From
04/07/2008 20:59:06
John Baird
Coatesville, Pennsylvania, United States
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01328995
Message ID:
01329065
Views:
13
public class MyComboBox : ComboBox

     public event EventHandler myEvent;

     protected virtual void OnMyEvent(EventArgs e)
     {
        if (this.myEvent != null)
        {
           this.myEvent(this, e);
        }
     }

     protected override void WndProc(ref System.Windows.Forms.Message m)
     {
           if (m.Msg == 0x201 //WM_LBUTTONDOWN || m.Msg == 0x203)  //WM_LBUTTONDBLCLK
           {
                this.OnMyEvent(new EventArgs());
                return;
           }
          base.WndProc(ref m);
     }
}

or

Public Class MyComboBox
     Inherits ComboBox

     Public Event myEvent As EventHandler
  
     Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
          If m.Msg = &H201 OrElse m.Msg = &H203 Then 'WM_LBUTTONDOWN or WM_LBUTTONDBLCLK
               RaiseEvent myEvent(Me, New EventArgs)
               Return
          End If
          MyBase.WndProc(m)

     End Sub 'WndProc
End Class 'MyComboBox
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform