简体   繁体   中英

Finding missing mouse clicks

I am working with a C# WinForms application which I'm not very familiar with. The control is intended to be draggable, and indeed it is draggable if the user starts the drag in parts of the control, but not in others.

The control contains several child controls, and it's my belief that some of these child controls are capturing the mouse clicks before the parent control sees them, hence the failure in certain areas. I have confirmed in the debugger that the mouse-down handler for the parent is only invoked when the user clicks on particular child controls.

Given I know the clicks are being captured/suppressed before they get to my handler, is there a way in the debugger (or otherwise) to determine where the clicks ARE going? Staring at the code has not been successful because I don't know where to start.

Bundled with Visual Studio comes a niftly little program called Spy++ . It allows you to log all messages being sent to windows, and shows you the 'real' structure of Win32 controls within your window (many controls are not actually controls but just custom painted screen areas). You should be able, with some inspection, to find the culprit with the message log.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM