/************************************************************************/ /* 移动主窗口事件,使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); } }
/************************************************************************/ /* 打开Extract窗口 */ /************************************************************************/ private void buttonExtract_Click(object sender, EventArgs e) { if (!FileService.checkExe()) { return; } if (extract == null || extract.IsDisposed) { extract = new Extract(); extract.Owner = this; } if (extract.Visible) { extract.Close(); return; } extract.Show(); if (bat != null && bat.Visible) { extract.SetDesktopLocation(this.Location.X + this.Width, this.Location.Y + bat.Height); } else { extract.SetDesktopLocation(this.Location.X + this.Width, this.Location.Y); } }