1.Control 刷新打开缓冲,防止闪烁
SetStyle(
ControlStyles.DoubleBuffer |
ControlStyles.OptimizedDoubleBuffer |
ControlStyles.AllPaintingInWmPaint, true);
UpdateStyles();
还有一思路是GDI描画界面,实际操作时再初始化控件,防止加载过多控件闪烁。
2.控件里新建一个
private System.ComponentModel.
IContainer components = null; 该控件 Control .Add() 时,将对象也添加到 新建的
components 里。
该控件 Control .Clear()时,同时调用
components .Dispose(), 可以使任务管理器里的 UserObject 数目 更改。 (是销毁了吗???)
3.SuspendLayout() 暂时挂起
ResumeLayout(false) 唤醒
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12913851/viewspace-620583/
,如需转载,请注明出处,否则将追究法律责任。