问题
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