Most other windows start centered in the main builder window. With multiple displays, windows would start in odd locatins and would often be lost.

This commit is contained in:
Tim Young 2017-02-25 10:53:23 +03:00
parent d948be0a54
commit abc42db1f8
14 changed files with 77 additions and 0 deletions

View File

@ -291,6 +291,7 @@
this.Icon = global::EduNetworkBuilder.Properties.Resources.NBIco;
this.Name = "DeviceConfig";
this.Text = "DeviceConfig";
this.Shown += new System.EventHandler(this.DeviceConfig_Shown);
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -542,5 +542,15 @@ namespace EduNetworkBuilder
}
UpdateForm();
}
private void DeviceConfig_Shown(object sender, EventArgs e)
{
BuilderWindow BW = NB.GetBuilderWin();
if(BW != null)
{
Point tLocation = new Point(BW.Location.X + ((BW.Width - Width) / 2), BW.Location.Y + ((BW.Height - Height) / 2));
Location = tLocation;
}
}
}
}

View File

@ -107,6 +107,7 @@
this.MinimumSize = new System.Drawing.Size(309, 250);
this.Name = "FirewallEditor";
this.Text = "FirewallEditor";
this.Shown += new System.EventHandler(this.FirewallEditor_Shown);
this.ResumeLayout(false);
}

View File

@ -168,5 +168,15 @@ namespace EduNetworkBuilder
lbRules.ContextMenuStrip.Show(Cursor.Position);
}
}
private void FirewallEditor_Shown(object sender, EventArgs e)
{
BuilderWindow BW = NB.GetBuilderWin();
if (BW != null)
{
Point tLocation = new Point(BW.Location.X + ((BW.Width - Width) / 2), BW.Location.Y + ((BW.Height - Height) / 2));
Location = tLocation;
}
}
}
}

View File

@ -121,6 +121,7 @@
this.Icon = global::EduNetworkBuilder.Properties.Resources.NBIco;
this.Name = "LinkEditor";
this.Text = "LinkEditor";
this.Shown += new System.EventHandler(this.LinkEditor_Shown);
this.ResumeLayout(false);
}

View File

@ -238,5 +238,15 @@ namespace EduNetworkBuilder
{
Close();
}
private void LinkEditor_Shown(object sender, EventArgs e)
{
BuilderWindow BW = NB.GetBuilderWin();
if (BW != null)
{
Point tLocation = new Point(BW.Location.X + ((BW.Width - Width) / 2), BW.Location.Y + ((BW.Height - Height) / 2));
Location = tLocation;
}
}
}
}

View File

@ -136,6 +136,7 @@
this.Name = "NetTestEditor";
this.Text = "Edit a Test";
this.Load += new System.EventHandler(this.NetTestEditor_Load);
this.Shown += new System.EventHandler(this.NetTestEditor_Shown);
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -495,5 +495,15 @@ namespace EduNetworkBuilder
UpdateForm();
}
}
private void NetTestEditor_Shown(object sender, EventArgs e)
{
BuilderWindow BW = NB.GetBuilderWin();
if (BW != null)
{
Point tLocation = new Point(BW.Location.X + ((BW.Width - Width) / 2), BW.Location.Y + ((BW.Height - Height) / 2));
Location = tLocation;
}
}
}
}

View File

@ -150,6 +150,7 @@
this.Icon = global::EduNetworkBuilder.Properties.Resources.NBIco;
this.Name = "NetworkCardEditor";
this.Text = "NetworkCardEditor";
this.Shown += new System.EventHandler(this.NetworkCardEditor_Shown);
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -194,5 +194,15 @@ namespace EduNetworkBuilder
MyNicToEdit.TunnelEndpoint.Edit(nd, this, NB.Translate("_Endpt"));
UpdateForm();
}
private void NetworkCardEditor_Shown(object sender, EventArgs e)
{
BuilderWindow BW = NB.GetBuilderWin();
if (BW != null)
{
Point tLocation = new Point(BW.Location.X + ((BW.Width - Width) / 2), BW.Location.Y + ((BW.Height - Height) / 2));
Location = tLocation;
}
}
}
}

View File

@ -289,6 +289,7 @@
this.Controls.Add(this.btnDone);
this.Name = "OptionsWindow";
this.Text = "OptionsWindow";
this.Shown += new System.EventHandler(this.OptionsWindow_Shown);
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -392,5 +392,15 @@ namespace EduNetworkBuilder
cb_ColoredPackets.Checked = false;
}
}
private void OptionsWindow_Shown(object sender, EventArgs e)
{
BuilderWindow BW = NB.GetBuilderWin();
if (BW != null)
{
Point tLocation = new Point(BW.Location.X + ((BW.Width - Width) / 2), BW.Location.Y + ((BW.Height - Height) / 2));
Location = tLocation;
}
}
}
}

View File

@ -89,6 +89,7 @@
this.Controls.Add(this.dgv_VLANAssignments);
this.Name = "VLANConfig";
this.Text = "VLANConfig";
this.Shown += new System.EventHandler(this.VLANConfig_Shown);
((System.ComponentModel.ISupportInitialize)(this.dgv_VLANAssignments)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dgv_VLANNames)).EndInit();
this.ResumeLayout(false);

View File

@ -433,5 +433,15 @@ namespace EduNetworkBuilder
dgv_VLANAssignments.CommitEdit(DataGridViewDataErrorContexts.Commit);
}
}
private void VLANConfig_Shown(object sender, EventArgs e)
{
BuilderWindow BW = NB.GetBuilderWin();
if (BW != null)
{
Point tLocation = new Point(BW.Location.X + ((BW.Width - Width) / 2), BW.Location.Y + ((BW.Height - Height) / 2));
Location = tLocation;
}
}
}
}