单例窗体

 当前页面代码 点击事件

 private void tsbStudent_Click(object sender, EventArgs e)
        {
            FrmStudent frm = FrmStudent.Instance;
            frm.MdiParent = this;
            frm.Show();
        }

 

//需要前往的页面代码    

private static FrmStudent instance;

        public static FrmStudent Instance
        {
            get {
                if (instance == null || instance.IsDisposed)
                {
                    instance = new FrmStudent();
                }
                return instance;
            }
           
        }

        private FrmStudent()
        {
            InitializeComponent();
        }

posted on 2013-12-01 16:45  月&&生  阅读(159)  评论(0编辑  收藏  举报