Flickering after resize despite the WS_EX_COMPOSIET flag and DoubleBuffered propertie

耗尽温柔 提交于 2019-12-07 20:45:18

问题


I have a TableLayoutPanel where I do some Drag&Drop stuff with the controls inside the layout. Unfortunately the controls are flickering after the drop action. I tried DoubleBuffered=true on all controls and a lot of other things. I also tried this solution: How to fix the flickering in User controls. And actually it works pretty well with the mentioned CreateParams. But only until I resize the form. It seems that windows forgets the WS_EX_COMPOSIET flag after a resize. It appears only with the aero theme. Without aero it keeps the settings of the CreateParams after a resize.

Is there any way to prevent flickering when the aero theme is turned on?


回答1:


on the the form resize Events (onResizeBegin & on ResizeEnd) use the following code :

protected override void OnResizeBegin(EventArgs e) 
 {
    SuspendLayout();
    base.OnResizeBegin(e);
 }

protected override void OnResizeEnd(EventArgs e) 
 {
    ResumeLayout();
    base.OnResizeEnd(e);
 }


来源:https://stackoverflow.com/questions/10716592/flickering-after-resize-despite-the-ws-ex-composiet-flag-and-doublebuffered-prop

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