C#(Windowsフォーム)を使用してコントロールのダブルバッファリングを有効にするにはどうすればよいですか?
-
03-07-2019 - |
質問
C#(Windowsフォーム)を使用してコントロールのダブルバッファリングを有効にするにはどうすればよいですか
私は、ものを描画しているパネルコントロールと、所有者が描画したタブコントロールを持っています。どちらもちらつきに悩まされているので、どうすればダブルバッファリングを有効にできますか?
解決
コントロールのコンストラクターで、DoubleBufferedプロパティおよび/またはControlStyleを適切に設定します。
たとえば、次のようなコンストラクタを持つ単純なDoubleBufferedPanelがあります:
this.DoubleBuffered = true;
this.SetStyle(ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint |
ControlStyles.ResizeRedraw |
ControlStyles.ContainerControl |
ControlStyles.OptimizedDoubleBuffer |
ControlStyles.SupportsTransparentBackColor
, true);
他のヒント
System.Windows.Forms.Controlから継承したDoubleBufferedプロパティを使用します。
System.Windows.Forms.Form myForm = new System.Windows.forms.Form();
myForm.DoubleBuffered = true;
所属していません StackOverflow