Home
Forums
New posts
Search forums
Articles
Latest reviews
Search resources
Members
Current visitors
Newsgroups
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Home
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
How to capture UserControl mouse events in it's container
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="ClayB [Syncfusion], post: 3945706"] You can have your UserControl implement IMessageFilter. This will allow it to get all messages application wide. You can then filter those messages down to the ones over your user control, and even further filter to to the specific you want to know about. Below is a code snippet. -- Clay Burch, .NET MVP Visit [URL="http://www.syncfusion.com"]www.syncfusion.com[/URL] for the coolest tools public class UserControl1 : System.Windows.Forms.UserControl , IMessageFilter { public UserControl1() { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); Application.AddMessageFilter(this); } const int WM_MOUSEMOVE = 0x200; const int WM_LBUTTONUP = 0x202; public bool PreFilterMessage(ref Message m) { if(!this.IsDisposed && this.Bounds.Contains(this.PointToClient(Control.MousePosition))) { if(m.Msg >= WM_MOUSEMOVE && m.Msg <= WM_LBUTTONUP) { Console.WriteLine(m.ToString()); // return true; //if you have handled teh message your self } } return false; } //.....more code } [/QUOTE]
Verification
Post reply
Home
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
How to capture UserControl mouse events in it's container
Top