示例#1
0
        //  override clo
        /// <summary>
        /// when Form Close ask sons change location
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SmartForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            PrinftHelper.PrinftNormal("Disconnect Event");
            ColorChanged -= SmartForm_ColorChanged;
            if (this.Owner is SmartForm && isClosedGoback)
            {
                SmartForm mather = (SmartForm)this.Owner;
                Point     temp   = new Point();
                switch (this.direc)
                {
                case Direction.right:  temp = new Point(this.Location.X + this.Width, this.Location.Y); break;

                case Direction.left: temp = new Point(this.Location.X - this.Width, this.Location.Y); break;

                case Direction.top: temp = new Point(this.Location.X, this.Location.Y - this.Height); break;

                case Direction.down: temp = new Point(this.Location.X, this.Location.Y + this.Height); break;
                }

                TellMatherReLocated(mather, this, temp);
                mather.EventLocationChanged -= this.form_EventLocationChanged;
            }
            else if (this.Owner is SmartForm)
            {
                SmartForm mather = (SmartForm)this.Owner;
                mather.EventLocationChanged -= this.form_EventLocationChanged;
            }
        }
示例#2
0
 //   Form Tool = null;
 public SmartForm()
 {
     InitializeComponent();
     this.ControlBox          = false;
     this.AutoScaleMode       = AutoScaleMode.Dpi;
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     PrinftHelper.PrinftNormal("Connect Event");
     ColorChanged += SmartForm_ColorChanged;
     //   this.AutoSize = true;
 }