Users Pricing

forum

Home Forums C# this.Invalidate() is blocking parent form to access – MindStick

C# this.Invalidate() is blocking parent form to access

Anonymous User 3060 24 Sep 2013

I have a button on MainForm whose button click event creates a ChildForm and shows. While ChildForm is shown, i can invoke any menu commands (each menu command is implemented to show a message box) which are defined on MainForm without any issues.

BUT, on other hand, I kept all the code as is and override OnPaint method of ChildForm with this.Invalidate() as shown below

protected override void OnPaint(PaintEventArgs e)

    {

        this.Invalidate();

        base.OnPaint(e);

    }

Can anyone put some light on what went wrong with overriding OnPaint method which executes this.Invalidate() line everytime and suggest how can I resolve this issue.


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md