ISupportInitialize (BeginInit/EndInit) 和 SuspendLayout/ResumeLayout 的区别
有人可以解释一下使用 ISupportInitialize 接口方法 (BeginInit/EndInit) 和使用 SuspendLayout/ResumeLayout 之间有什么区别吗?
ISupportInitialize 仅在构造/“初始”初始化期间使用...还是可以在以后当您想要将新的子控件添加到现有父控件时使用?
有什么特别的区别吗?
我非常感谢你的帮助!
谢谢你,
帕托
Could someone please explain what the difference is between using the ISupportInitialize interface methods (BeginInit/EndInit) and using SuspendLayout/ResumeLayout?
Is ISupportInitialize ONLY used during construction/"initial" initialization... or can it be used later when you want to add new child controls to an existing parent control?
Any particular differences?
I greatly appreciate your help!
Thank you,
Pato
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
ISupportInitialize 接口位于 System.dll 中,只是组件领域中一个相当通用的概念。 顺便说一句,System.Windows.Forms 的许多部分都是组件,而且 Windows.Forms 是 ComponentModel 内容的主要用户。
Suspend/ResumeLayout 是一个纯粹的 Windows.Forms 事物,它实际上告诉控件在添加子控件或更改属性时不要尝试执行图形操作。
The interface ISupportInitialize lives in the System.dll and is just a fairly generic concept in the realm of Components. Incidentally, many parts of System.Windows.Forms are Components, and also Windows.Forms is the main user of the ComponentModel stuff.
Suspend/ResumeLayout is a pure Windows.Forms thing and really telling a control to not try and do graphics while you are e.g. adding child controls or changing properties.
为此纠正 VB.Net 中使用的代码,大多数反编译器都会出错。
Correct used code in VB.Net for this, most decompilers get this wrong.