Need help on subclassing windows
-
Hi guys, I've developed in C++ for many years, but more recently have been working in C# and VB.NET. I am developing my own version of themed controls where the user can govern just about any aspect of control drawing, like shape and colour etc. I want to extend this control now to Windows Captions (i.e. Form captions). One thing that I have never fully gained is an understanding of what windows messages to trap, whether to let the default processing always take place, and what values to return. Even when I think I am following the MSDN SDK documention on WM_... notifications I still can't seem to get it right. My problem seems to mainly be in getting setup, i.e. calling GetWindowDC to give me the entire drawing area of the window. Once I have called GetWindowDC I can construct a .NET Graphics object, and later dispose of both after my drawing is complete. I do this and clear the Graphics object to red, so I should see all the non-client area turn red, which happens when the window is first drawn, but after that, as I start to move the window or size it I dont see the DC get consistently filled with red. In summary then, if I could get a control of non-client drawing then I would have raised my programming standard significantly. I would really be immensley greatful if you guys could point me at a definitive guide to subclassing or window's message processing, without recommending 3rd part controls as I am a DIY fanatic! 8-) Also, if any of you can spare some time now and again, perhaps on MSN messenger to chat about this issue that would just be solid gold. I await your responses with baited breath! Thanks all! Nursey
-
Hi guys, I've developed in C++ for many years, but more recently have been working in C# and VB.NET. I am developing my own version of themed controls where the user can govern just about any aspect of control drawing, like shape and colour etc. I want to extend this control now to Windows Captions (i.e. Form captions). One thing that I have never fully gained is an understanding of what windows messages to trap, whether to let the default processing always take place, and what values to return. Even when I think I am following the MSDN SDK documention on WM_... notifications I still can't seem to get it right. My problem seems to mainly be in getting setup, i.e. calling GetWindowDC to give me the entire drawing area of the window. Once I have called GetWindowDC I can construct a .NET Graphics object, and later dispose of both after my drawing is complete. I do this and clear the Graphics object to red, so I should see all the non-client area turn red, which happens when the window is first drawn, but after that, as I start to move the window or size it I dont see the DC get consistently filled with red. In summary then, if I could get a control of non-client drawing then I would have raised my programming standard significantly. I would really be immensley greatful if you guys could point me at a definitive guide to subclassing or window's message processing, without recommending 3rd part controls as I am a DIY fanatic! 8-) Also, if any of you can spare some time now and again, perhaps on MSN messenger to chat about this issue that would just be solid gold. I await your responses with baited breath! Thanks all! Nursey
Override the
OnMessage
method which recieves aMessage
structure. -
Override the
OnMessage
method which recieves aMessage
structure.Thanks but I know how to get to the messages. As I said the problem has always been what messages to process. To be specific, what messages do I have to trap and process if I want to take entire responsibility for NC processing/drawing? Do I always have to perform the default processing then do my thing? See? Thanks. Nursey