Prevent window redraw when resizing c# windows forms

眉间皱痕 提交于 2020-01-20 14:21:10

问题


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.


回答1:


Nevermind, just found these two events.

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

Works a treat



来源:https://stackoverflow.com/questions/2353381/prevent-window-redraw-when-resizing-c-sharp-windows-forms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!