<small id='HMdJE'></small><noframes id='HMdJE'>

        <tfoot id='HMdJE'></tfoot>

          <bdo id='HMdJE'></bdo><ul id='HMdJE'></ul>
        <legend id='HMdJE'><style id='HMdJE'><dir id='HMdJE'><q id='HMdJE'></q></dir></style></legend>
      1. <i id='HMdJE'><tr id='HMdJE'><dt id='HMdJE'><q id='HMdJE'><span id='HMdJE'><b id='HMdJE'><form id='HMdJE'><ins id='HMdJE'></ins><ul id='HMdJE'></ul><sub id='HMdJE'></sub></form><legend id='HMdJE'></legend><bdo id='HMdJE'><pre id='HMdJE'><center id='HMdJE'></center></pre></bdo></b><th id='HMdJE'></th></span></q></dt></tr></i><div id='HMdJE'><tfoot id='HMdJE'></tfoot><dl id='HMdJE'><fieldset id='HMdJE'></fieldset></dl></div>

        Winforms Form Constructor vs Load事件

        Winforms Form Constructor vs Load event(Winforms Form Constructor vs Load事件)
          <tbody id='rvHv6'></tbody>

      2. <i id='rvHv6'><tr id='rvHv6'><dt id='rvHv6'><q id='rvHv6'><span id='rvHv6'><b id='rvHv6'><form id='rvHv6'><ins id='rvHv6'></ins><ul id='rvHv6'></ul><sub id='rvHv6'></sub></form><legend id='rvHv6'></legend><bdo id='rvHv6'><pre id='rvHv6'><center id='rvHv6'></center></pre></bdo></b><th id='rvHv6'></th></span></q></dt></tr></i><div id='rvHv6'><tfoot id='rvHv6'></tfoot><dl id='rvHv6'><fieldset id='rvHv6'></fieldset></dl></div>

          • <legend id='rvHv6'><style id='rvHv6'><dir id='rvHv6'><q id='rvHv6'></q></dir></style></legend>
              <bdo id='rvHv6'></bdo><ul id='rvHv6'></ul>
              <tfoot id='rvHv6'></tfoot>

                1. <small id='rvHv6'></small><noframes id='rvHv6'>

                  本文介绍了Winforms Form Constructor vs Load事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  加载表单时,代码需要执行诸如设置数据网格、组合框、设置标题等操作.我倾向于始终使用加载事件而不是新的(构造函数).是否有针对哪些活动最适合哪些活动的指南?

                  When a form loads, the code needs to do things like setup datagrids, comboboxes, set the title, etc. I've tended to always use the load event rather than the new (constructor). Are there any guidelines for which one is best for which activities?

                  推荐答案

                  对 InitializeComponent 的调用会自动插入到表单/页面的构造函数中.InitializeComponent 是自动生成的方法,

                  A call to InitializeComponent is automatically inserted in the constructor of your form/page. InitializeComponent is the auto-generated method that

                  • 在您的 winform/XAML 页面上创建各种 UI 元素
                  • 使用存储在资源文件中的值初始化它们的属性

                  因此,与 UI 安排/修改相关的任何内容都应此调用之后进行.当您在 Form.OnLoad 的覆盖中执行此操作时,您可以确保 UI 已准备就绪(已调用 InitializeComponent)...所以我会投票支持 UI 的 OnLoad.
                  创建非 UI 成员,构造函数将是我首先要看的地方.

                  So anything related to UI arrangement/modifications should go after this call. When you do this in an override of Form.OnLoad , you're assured that the UI is ready to go (InitializeComponent has been called)... so I'd vote for sticking to OnLoad for UI.
                  Creating non-UI members, constructor would be the place I'd first look at.

                  这篇关于Winforms Form Constructor vs Load事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)
                  Parameter count mismatch with Invoke?(参数计数与调用不匹配?)
                  How to store delegates in a List(如何将代表存储在列表中)
                  Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)
                  CreateDelegate with unknown types(具有未知类型的 CreateDelegate)
                  Does Funclt;Tgt;.BeginInvoke use the ThreadPool?(Funclt;Tgt;.BeginInvoke 使用线程池吗?)

                    <i id='Yn3sW'><tr id='Yn3sW'><dt id='Yn3sW'><q id='Yn3sW'><span id='Yn3sW'><b id='Yn3sW'><form id='Yn3sW'><ins id='Yn3sW'></ins><ul id='Yn3sW'></ul><sub id='Yn3sW'></sub></form><legend id='Yn3sW'></legend><bdo id='Yn3sW'><pre id='Yn3sW'><center id='Yn3sW'></center></pre></bdo></b><th id='Yn3sW'></th></span></q></dt></tr></i><div id='Yn3sW'><tfoot id='Yn3sW'></tfoot><dl id='Yn3sW'><fieldset id='Yn3sW'></fieldset></dl></div>
                  • <small id='Yn3sW'></small><noframes id='Yn3sW'>

                        <bdo id='Yn3sW'></bdo><ul id='Yn3sW'></ul>

                            <tbody id='Yn3sW'></tbody>

                          <legend id='Yn3sW'><style id='Yn3sW'><dir id='Yn3sW'><q id='Yn3sW'></q></dir></style></legend>

                          <tfoot id='Yn3sW'></tfoot>