Jase Posted November 4, 2003 Posted November 4, 2003 Hi. Until now I have been overriding WndProc() to find when the mouse is clicked on a custom control so that I can highlight a soft control located within to edit its properties in the property editor. I got this method from several books on custom controls including one by Richard Weeks. After reading Divil's contribution (excellent) I tried implementing GetHitTest() instead and this works just fine without having to get dirty with win32. It appears to be a much better (native) way to do it. Is this new to .Net2003? Does anyone know a reason why you would override WndProc when GetHitTest() appears to work fine? Have I missed something? thanks:) Quote
AlexCode Posted November 6, 2003 Posted November 6, 2003 I really don't know why that someone would prefer WndProc but be carefull about the books your read... some are about the Beta version of .net, where quite a lot of methods weren't implemented or in diferent namespaces... Quote Software bugs are impossible to detect by anybody except the end user.
*Experts* Volte Posted November 6, 2003 *Experts* Posted November 6, 2003 No advantage using the API over GetHitTest() as far as I can see. Quote
*Gurus* divil Posted November 6, 2003 *Gurus* Posted November 6, 2003 GetHitTest is a better way of doing it that subclassing for messages in the designer. Also, you might try looking at the MouseDragBegin procedure of ControlDesigner that you can override to also provide this soft highlighting feature. If you plan on allowing the user to drag this subcomponent, using the built in OLE drag and drop methods is preferable too. The goal is really to remove all design-time functionality from the control itself and put it in the designer. The thing with GetHitTest is that your logic will still be in the control and not the designer, which actually carries a performance penalty. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.