Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent window redraw when resizing c# windows forms

Tags:

What windows message or event can i listen to in order to stop a window from being redrawing every pixel of it's resize?

That is, when a user clicks on the edge of the window and starts to re-size it, i don't want to re-draw the entire contents until he lets go. This is because for some reason it's currently choppy at resizing probably because everything is re-docking and what not.

I tried WM_SIZING but that only tells me it's being re-sized, i wish to know the start and end of the sizing so i can suspend the layout until the user stops resizing.

like image 342
Daniel Avatar asked Mar 01 '10 01:03

Daniel


1 Answers

Nevermind, just found these two events.

this.ResizeBegin += (s, e) => { this.SuspendLayout(); }; this.ResizeEnd += (s, e) => { this.ResumeLayout(true); }; 

Works a treat

like image 93
Daniel Avatar answered Sep 19 '22 20:09

Daniel