我想提出一個Windows窗體應用程序,主要在我的屏幕是3個部分之間劃分像如何避免屏幕閃爍?
===========================================================================
Top panel (it doesn't flicker)
===========================================================================
|| || 'it has a panel & panel contains a table layout,this tabble layout'
|| || 'has a picture box and a label, picture & text of label is'
|| ||'changed on the click of side bar menu' (PROB: this flickers a lot)
||side bar ||==============================================================
||(doesn't ||'this part also has a panel and panel contains different table'
||flicker) ||'layouts and on the click of a menu, related table layout is shown and'
|| ||'some of the parts of table layout are created dynamically.'
|| ||
|| || (PROB: this flickers a lot)
|| ||
我搜索了很多,發現這個解決方案無處不在,我想這
public constructor()
{
InitializeComponent();
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
this.DoubleBuffered = true;
DoubleBuffered = true;
SetStyle(ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint |
ControlStyles.ResizeRedraw |
ControlStyles.ContainerControl |
ControlStyles.OptimizedDoubleBuffer |
ControlStyles.SupportsTransparentBackColor
, true);
}
我也試過這種
protected override CreateParams CreateParams
{
get
{
CreateParams handleParam = base.CreateParams;
handleParam.ExStyle |= 0x02000000; // WS_EX_COMPOSITED
return handleParam;
}
}
它改變我的屏幕的整個背景爲黑色。
但仍然問題仍然是一樣的,有人能告訴我如何解決這個問題,我在哪裏做錯了? 非常感謝。
屏幕不閃爍沒有更新。所以請向我們展示重複更新閃爍部分的代碼。 – 2013-05-08 13:13:28
什麼控件類型是閃爍的?你在做什麼這些問題控制? EG:加載100,000條記錄以供顯示等等...... – Justin 2013-05-08 13:13:44
你對這個表格做什麼?我的意思是:在哪個動作閃爍?如果你製作了一個WinForm,比如面板等3個區域,並在這些面板上放置了一些控件,它就不應該閃爍。無論是點擊面板還是拖動窗口。 – Michael 2013-05-08 13:13:58