问题描述
我使用考勤标记目的的一个TableLayoutPanel。我加入控制该TableLayoutPanel中的内(面板和标签),并为他们创造活动。在有些情况我已清除所有控件,并着手在绑定的TableLayoutPanel中不同位置相同的控件。虽然重新绑定控件,TableLayoutPanel中闪烁,实在太慢初始化。
I am using a TableLayoutPanel for attendance marking purposes. I have added controls (a Panel and a Label) inside of this TableLayoutPanel and created events for them. In some conditions I have cleared all of the controls and proceeded to bind the same controls in different position of TableLayoutPanel. While re-binding the controls, the TableLayoutPanel flickers and is far too slow in initializing.
推荐答案
挂起的布局,直到你。加在所有控件
Suspend the layout until you've added all your controls on.
TableLayoutPanel panel = new TabelLayoutPanel();
panel.SuspendLayout();
// add controls
panel.ResumeLayout();
另外,也要看看使用双缓冲。你必须创建一个子类的TableLayoutPanel的。这里看一个例子。
Also look at using Double Buffering. You'll have to create a sub-class of the TableLayoutPanel. See an example here.
这篇关于如何避免在C#.NET在TableLayoutPanel中忽隐忽现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!