zoukankan      html  css  js  c++  java
  • MDI 窗体中打开子窗体的函数。

    代码如下:
    程序代码
      private void OpenChild(string Frmnamespace, string ChildTypeName)
            {
                int ret = 0;
                foreach (Form frm in MdiChildren)
                {
                    if (frm.GetType().Name == ChildTypeName)
                    {
                        frm.Activate();
                        ret = 1;
                        break;
                    }
                }
                if (0 == ret)
                {
                    string className = Frmnamespace + "." + ChildTypeName;
                    Form Instance = (Form) Assembly.Load(Frmnamespace).CreateInstance(className);
                    Instance.MdiParent = this;
                    Instance.Show();
                }
            }
    传入一个窗体,先检查这个窗体是不是有副本,如果有副本,则置前,否则新创建并显示.
    使用方法:
    程序代码
    private void LbtUserManager_ItemClick(object sender, ItemClickEventArgs e)
            {
                OpenChild("OuterRingRoad", "frmUserManager");
            }
            private void MenuUserPopdemod_ItemClick(object sender, ItemClickEventArgs e)
            {
                OpenChild("OuterRingRoad", "frmUserPopdemod");
            }
            private void MenuCurrentTimeData_ItemClick(object sender, ItemClickEventArgs e)
            {
                OpenChild("ORRTLB", "frmNowVDIInfo");
            }
            private void MenuCarCheckConfig_ItemClick(object sender, ItemClickEventArgs e)
            {
                OpenChild("ORRTLB", "frmVDISetting");
            }

  • 相关阅读:
    57. Insert Interval
    287. Find the Duplicate Number
    52. N-Queens II
    51. N-Queens
    151. Reverse Words in a String
    29. Divide Two Integers
    [POJ2104]K-th Number
    [JSOI2008]最大数
    [BZOJ3673&3674]可持久化并查集&加强版
    C++ STL rope介绍----可持久化平衡树
  • 原文地址:https://www.cnblogs.com/bennylam/p/1590401.html
Copyright © 2011-2022 走看看