views:

618

answers:

1

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.

+4  A: 

Nevermind, just found these two events.

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

Works a treat

Daniel
Accept this as the answer, will be useful for people searching for the same problem in the future
Nick Craver
It says i have to wait 2 days before i can answer my own question
Daniel
+1 for use of Lambda syntax in event assignment. But, users please note : if this type of syntax using 'e is used inside something like a Form Load event, or anything using the standard 'e name for an EventArgument type argument : the variable name 'e will already be in use, so changing to something else like 'evt might be handy.
BillW