Sub-classing techniques
Once we understand the previous architecture, it makes sense to use it in a variety of ways: avoiding predefined behaviors for controls or windows, adding specific elements to existing windows components, and many others.
Let's try a basic example. Suppose that we want to change the way a window responds to the left button. Only that. So, we have a simple Windows Forms application, and we need to think of the elements we need in order to code that behavior.
First, we need to capture the specific messages addressed to the left button. Then, we have the override to WndProc associated with our window, determine what to do if the message is the one required, and finally, always return the control to the operating system correctly. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access