As someone how has been designing and developing WinForms based applications for the past 7+ years, I have learned that subclassing UI controls is a must. You may be thinking, why would I want to subclass a text box? Or a combo box? The answer is simple, the better future proof your app.
How many times have you been into the development cycle of your application and you found out that you needed/wanted to extend the text box that is being used. By extend I am not necessary talking about adding functionality to it, but do something like having the control highlight the entire contents of the control when the it receives focus.
If you don't have your controls subclassed, extending your control will be a pain in your ass. Sure you could find EVERY use of the control and add the needed code. Or you could find and replace your control later with the subclassed control, but both of these suck.
When I start a new WinForms (same concept should work for Browser based as well) application, I will immediately add a Controls namespace and simply add my subclassed controls. In many cases I never extend the control, but knowing that I can do so allows me to make better decisions later on.
One example of where this has helped me in the past was on a project where about 6 months into development, the business owners decided that would like the UI controls (text box, check box, combo box, etc) to change background color when the control receives focus and then change back when it loses focus. Because I had everything subclassed i was able to implement this request in a very short time frame and did not even have to open up a single form. Had I not subclasses the controls I would have either pushed back heavily or it would have taken me much longer to implement this change.
Another good use is for things like data grids. Whether you are using the out of the box data grid, or some third party grid like Infragistics or Janus, subclassing can save you a ton. How many times have you developed an application where you wanted a standard look and feel for your grids. Say every other line is gray, and there are no selection column. If the control is not subclassed you are asking each developer to remember to make the look and feel customizations. But, if it is subclassed, simply add the control to the form and you are done.
Till next time,