[DllImport("user32.dll")]
static extern bool LockWindowUpdate(IntPtr hWndLock);
pravate void dosomething()
{
LockWindowUpdate(panelContainer.Handle);
// Clear Panel
panelContainer.Controls.Clear();
// my temporary TextBox
TextBox myT ;
for (int lauf=0; lauf < 200; lauf++)
{
// Create New TextBox
myT = new TextBox();
// Add TextBox to the Panel
panelContainer.Controls.Add(myT);
}
// redraw the window
LockWindowUpdate(IntPtr.Zero);
}缓解加载显示大量控件时闪烁和线条显示的问题
最新推荐文章于 2020-04-27 14:07:42 发布
本文展示了一个使用 C# 在 Windows Forms 中批量创建 TextBox 控件的例子,并通过 LockWindowUpdate 函数确保界面更新流畅。
4548

被折叠的 条评论
为什么被折叠?



