Example #1
0
 // 该函数用于只创建一个对象
 public static FrmSingleton CreateFrm()
 {
     if (m_frmSingletonFrm == null)
     {
         m_frmSingletonFrm = new FrmSingleton();
     }
     return(m_frmSingletonFrm);
 }
Example #2
0
 // 当该窗口关闭时释放
 protected override void OnClosed(EventArgs e)
 {
     base.OnClosed(e);
     m_frmSingletonFrm = null;
 }
Example #3
0
        private void btn_CreateSingletonFrm_Click(object sender, EventArgs e)
        {
            FrmSingleton l_frmSingleton = FrmSingleton.CreateFrm();

            l_frmSingleton.Show();
        }