Windows Forms: Enable/Disable WS_CLIPCHILDREN

Posted by Agnel Kurian on Stack Overflow See other posts from Stack Overflow or by Agnel Kurian
Published on 2010-03-25T07:34:10Z Indexed on 2010/03/25 7:53 UTC
Read the original article Hit count: 411

Filed under:
|
|
|
|

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#.

© Stack Overflow or respective owner

Related posts about winforms

Related posts about Windows