代码改变世界

SuspendLayout()

2011-07-27 12:15  symphony2010  阅读(324)  评论(0编辑  收藏  举报

今天想用weifenluo这个控件,但在vs2010里面出现了错误,于是试着看能不能分析源代码找到一些规律.

在其中的DockAreasEditorControl类里:

遇到SuspendLayout();该函数什么功能?

查找MSDN当然能找到答案,不过重点是不用该函数会产生什么结果?微软MSDN里面这句话给了解释:

When adding several controls to a parent control, it is recommended that you call the SuspendLayout method before initializing the controls to be added. After adding the controls to the parent control, call the ResumeLayout method. This will increase the performance of applications with many controls.

当添加多个控件时,会提高性能.