PaN*_*1Me 3 c# service winforms
我有一个表格
MyForm : System.Windows.Forms.Form {}
Run Code Online (Sandbox Code Playgroud)
我需要打电话
Site.GetService(..)
Run Code Online (Sandbox Code Playgroud)
在用户开始使用此表单之前。
但它在构造函数和我尝试覆盖的所有加载事件中为空。请问网站什么时候不为空?
默认情况下,IComponent.Site仅在 Visual Studio 设计器中设置。它用于 IDE 中的设计时服务,例如命名组件。这是一篇讨论如何使用站点的文章:Design-Time Integration\xe2\x80\x94Hosts, Containers, and Sites。