diff --git a/EduNetworkBuilder/NetworkBuilder.Designer.cs b/EduNetworkBuilder/NetworkBuilder.Designer.cs index b4c4950..f5f3ebb 100644 --- a/EduNetworkBuilder/NetworkBuilder.Designer.cs +++ b/EduNetworkBuilder/NetworkBuilder.Designer.cs @@ -60,12 +60,14 @@ this.twoNetworksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.threeNetworksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.firewallsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.VLANToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toSolveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.solvedDHCPToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.solvedOneNetworkToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.solvedTwoNetworksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SolvedThreeNetworksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.firewallsToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.SolvedVLANToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.panelChoices = new System.Windows.Forms.Panel(); this.lbMessages = new System.Windows.Forms.ListBox(); this.lblStatus = new System.Windows.Forms.Label(); @@ -78,8 +80,6 @@ this.HelpPanel = new System.Windows.Forms.Panel(); this.cbViewTitles = new System.Windows.Forms.CheckBox(); this.myProgressBar = new System.Windows.Forms.ProgressBar(); - this.VLANToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SolvedVLANToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.msMainMenuStrip.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pbNetworkView)).BeginInit(); this.HelpPanel.SuspendLayout(); @@ -289,7 +289,7 @@ // puzzlesToolStripMenuItem // this.puzzlesToolStripMenuItem.Name = "puzzlesToolStripMenuItem"; - this.puzzlesToolStripMenuItem.Size = new System.Drawing.Size(181, 26); + this.puzzlesToolStripMenuItem.Size = new System.Drawing.Size(140, 26); this.puzzlesToolStripMenuItem.Text = "Puzzles"; this.puzzlesToolStripMenuItem.Click += new System.EventHandler(this.puzzlesToolStripMenuItem_Click); // @@ -303,7 +303,7 @@ this.firewallsToolStripMenuItem, this.VLANToolStripMenuItem}); this.solvedToolStripMenuItem.Name = "solvedToolStripMenuItem"; - this.solvedToolStripMenuItem.Size = new System.Drawing.Size(181, 26); + this.solvedToolStripMenuItem.Size = new System.Drawing.Size(140, 26); this.solvedToolStripMenuItem.Text = "Solved"; // // dHCPToolStripMenuItem @@ -341,6 +341,13 @@ this.firewallsToolStripMenuItem.Text = "Firewalls"; this.firewallsToolStripMenuItem.Click += new System.EventHandler(this.firewallsToolStripMenuItem_Click); // + // VLANToolStripMenuItem + // + this.VLANToolStripMenuItem.Name = "VLANToolStripMenuItem"; + this.VLANToolStripMenuItem.Size = new System.Drawing.Size(187, 26); + this.VLANToolStripMenuItem.Text = "VLAN"; + this.VLANToolStripMenuItem.Click += new System.EventHandler(this.VLANToolStripMenuItem_Click); + // // toSolveToolStripMenuItem // this.toSolveToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -351,7 +358,7 @@ this.firewallsToolStripMenuItem1, this.SolvedVLANToolStripMenuItem1}); this.toSolveToolStripMenuItem.Name = "toSolveToolStripMenuItem"; - this.toSolveToolStripMenuItem.Size = new System.Drawing.Size(181, 26); + this.toSolveToolStripMenuItem.Size = new System.Drawing.Size(140, 26); this.toSolveToolStripMenuItem.Text = "To Solve"; // // solvedDHCPToolStripMenuItem @@ -389,6 +396,13 @@ this.firewallsToolStripMenuItem1.Text = "Firewalls"; this.firewallsToolStripMenuItem1.Click += new System.EventHandler(this.firewallsToolStripMenuItem1_Click); // + // SolvedVLANToolStripMenuItem1 + // + this.SolvedVLANToolStripMenuItem1.Name = "SolvedVLANToolStripMenuItem1"; + this.SolvedVLANToolStripMenuItem1.Size = new System.Drawing.Size(187, 26); + this.SolvedVLANToolStripMenuItem1.Text = "VLAN"; + this.SolvedVLANToolStripMenuItem1.Click += new System.EventHandler(this.SolvedVLANToolStripMenuItem1_Click); + // // panelChoices // this.panelChoices.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -522,7 +536,7 @@ // this.cbViewTitles.AutoSize = true; this.cbViewTitles.Location = new System.Drawing.Point(7, 9); - this.cbViewTitles.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.cbViewTitles.Margin = new System.Windows.Forms.Padding(4); this.cbViewTitles.Name = "cbViewTitles"; this.cbViewTitles.Size = new System.Drawing.Size(18, 17); this.cbViewTitles.TabIndex = 10; @@ -539,20 +553,6 @@ this.myProgressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous; this.myProgressBar.TabIndex = 11; // - // VLANToolStripMenuItem - // - this.VLANToolStripMenuItem.Name = "VLANToolStripMenuItem"; - this.VLANToolStripMenuItem.Size = new System.Drawing.Size(187, 26); - this.VLANToolStripMenuItem.Text = "VLAN"; - this.VLANToolStripMenuItem.Click += new System.EventHandler(this.VLANToolStripMenuItem_Click); - // - // SolvedVLANToolStripMenuItem1 - // - this.SolvedVLANToolStripMenuItem1.Name = "SolvedVLANToolStripMenuItem1"; - this.SolvedVLANToolStripMenuItem1.Size = new System.Drawing.Size(187, 26); - this.SolvedVLANToolStripMenuItem1.Text = "VLAN"; - this.SolvedVLANToolStripMenuItem1.Click += new System.EventHandler(this.SolvedVLANToolStripMenuItem1_Click); - // // BuilderWindow // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); @@ -572,6 +572,7 @@ this.Text = "Network Builder"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BuilderWindow_FormClosing); this.Load += new System.EventHandler(this.BuilderWindow_Load); + this.Shown += new System.EventHandler(this.BuilderWindow_Shown); this.ResizeEnd += new System.EventHandler(this.BuilderWindow_ResizeEnd); this.Resize += new System.EventHandler(this.BuilderWindow_Resize); this.msMainMenuStrip.ResumeLayout(false); diff --git a/EduNetworkBuilder/NetworkBuilder.cs b/EduNetworkBuilder/NetworkBuilder.cs index 3993cae..825d5fa 100644 --- a/EduNetworkBuilder/NetworkBuilder.cs +++ b/EduNetworkBuilder/NetworkBuilder.cs @@ -1412,6 +1412,23 @@ namespace EduNetworkBuilder UpdateVisuals(); } } - + + private void BuilderWindow_Shown(object sender, EventArgs e) + { + //Console.WriteLine(this.DesktopLocation.X); + //Console.WriteLine(Screen.FromControl(this).WorkingArea.ToString()); + int x = this.DesktopLocation.X; + int y = this.DesktopLocation.Y; + + if (x + this.Width > Screen.FromControl(this).WorkingArea.X) + x = Screen.FromControl(this).WorkingArea.X - this.Width; + if (x < 0) x = 0; + + if (y + this.Height > Screen.FromControl(this).WorkingArea.Y) + y = Screen.FromControl(this).WorkingArea.Y - this.Height; + if (y < 0) y = 0; + + this.DesktopLocation = new Point(x, y); + } } } \ No newline at end of file