George
George

Reputation: 85

how to refresh a window without refreshing the images of the window in C#?

I have a program I wrote in C# with a window that contain a groupBox with image.

I have a button that do some things (it doesn't matter what exactly) and it refresh the window in his loop (in button_click function) (with this.Refresh();).

Does there is a way that I can refresh the window without refreshing the groupBox?

*I have another problem, I cant minimize the window while the button_click function working. there is something I can do to solve it?

Upvotes: 3

Views: 406

Answers (1)

Jalal Said
Jalal Said

Reputation: 16162

Use Invalidate() instead of Refresh()

this.Invalidate(false);//false to not redraw the controls in the form.

Edit: msdn

Calling the Invalidate method does not force a synchronous paint; to force a synchronous paint, call the Update method after calling the Invalidate method

so:

this.Invalidate(false);
this.Update();

Upvotes: 2

Related Questions