Windows Forms: Enable/Disable WS_CLIPCHILDREN
- by Agnel Kurian
How do I turn on/off the WS_CLIPCHILDREN window style in a Windows Forms parent control?
I would like to display some text on top of the child control after it has painted. In my parent control, this is what I have:
class Parent : public Control {
void Parent::OnPaint(PaintEventArgs ^e){
Control::OnPaint(e);
// parent draws here
// some drawing should happen over the child windows
// in other words, do not clip child window regions
}
};
On checking with Spy++ I find that the parent has the WS_CLIPCHILDREN window style enabled by default. What is the Windows Forms way to turn this off?
Note: Sample code is in C++/CLI but I have tagged this C# for visibility... language is immaterial here. Feel free to translate the code to C#.