using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;

namespace 网络中心计费系统
{
    public class ObjectForm : System.Windows.Forms.Form//ObjectForm已经续承Form的属性了
    {
      
        private bool _OnClose;
        protected override void OnLoad(EventArgs e)//重写OnLoad()
        {
            if (this.OnClose)
            {
                if (this.ParentForm != null)
                {
                    foreach (System.Windows.Forms.Form f in this.ParentForm.MdiChildren)
                    {
                        if (f != this)
                            f.Close();
                    }
                }
            }
            base.OnLoad(e);//保持原来的OnLoad()
        }


        [DefaultValue(false), ToolboxItem("是否关闭")]//DefaultValue(false)是默认值.
        public bool OnClose//设置属性
        {
            get { return this._OnClose; }
            set { this._OnClose = value; }
        }

 

        private void InitializeComponent()
        {
            this.SuspendLayout();
            //
            // ObjectForm
            //
            this.ClientSize = new System.Drawing.Size(368, 266);
            this.Name = "ObjectForm";
            this.Load += new System.EventHandler(this.ObjectForm_Load);
            this.ResumeLayout(false);

        }

        private void ObjectForm_Load(object sender, EventArgs e)
        {

        }
    }
}

posted on 2008-11-14 15:59  伯煌  阅读(238)  评论(0编辑  收藏  举报