Пример #1
0
        /************************************************************************/
        /* 移动主窗口事件,使Bat和Extract窗口跟随移动。                         */
        /************************************************************************/
        private void FormMain_Move(object sender, EventArgs e)
        {
            if (bat == null && extract == null) {
                return;
            }
            if (bat != null && bat.IsDisposed) {
                bat = null;
            }
            if (extract != null && extract.IsDisposed) {
                extract = null;
            }
            if (bat == null && extract == null) {
                return;
            }

            Form f1, f2 = null;
            if (bat == null || extract == null) {
                f1 = bat != null ? (Form)bat : extract;
            } else if (bat.Visible != extract.Visible) {
                f1 = bat.Visible ? (Form)bat : extract;
                f1.SetDesktopLocation(this.Location.X + this.Width, this.Location.Y);
                //f1.TopMost=true;
            } else {
                f1 = bat.Location.Y > extract.Location.Y ? (Form)extract : bat;
                f2 = bat.Location.Y <= extract.Location.Y ? (Form)extract : bat;
            }

            f1.SetDesktopLocation(this.Location.X + this.Width, this.Location.Y);
            if (f2 != null) {
                f2.SetDesktopLocation(this.Location.X + this.Width, this.Location.Y + f1.Height);
            }
        }
Пример #2
0
 /************************************************************************/
 /* 打开Bat窗口                                                          */
 /************************************************************************/
 private void buttonBat_Click(object sender, EventArgs e)
 {
     if (bat == null || bat.IsDisposed) {
         bat = new Bat();
         bat.Owner = this;
     }
     if (bat.Visible) {
         bat.Close();
         return;
     }
     bat.Show();
     if (extract != null && extract.Visible) {
         bat.SetDesktopLocation(this.Location.X + this.Width, this.Location.Y + extract.Height);
     } else {
         bat.SetDesktopLocation(this.Location.X + this.Width, this.Location.Y);
     }
 }