Robotregent
Robotregent

Reputation: 95

Flickering after resize despite the WS_EX_COMPOSIET flag and DoubleBuffered propertie

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?

Upvotes: 2

Views: 431

Answers (1)

Eslam Gamal
Eslam Gamal

Reputation: 74

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);
 }

Upvotes: 1

Related Questions