Add the images of the various devices involved creating or editing a link.

This commit is contained in:
Tim Young 2023-08-17 08:51:46 -07:00
parent 5fc1e19f71
commit 2f4cf36011
3 changed files with 67 additions and 20 deletions

View File

@ -35,53 +35,62 @@
this.btnLink = new System.Windows.Forms.Button(); this.btnLink = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button();
this.cbLinkType = new System.Windows.Forms.ComboBox(); this.cbLinkType = new System.Windows.Forms.ComboBox();
this.pbSource = new System.Windows.Forms.PictureBox();
this.pbDest = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.pbSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbDest)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// lbSrcHost // lbSrcHost
// //
this.lbSrcHost.FormattingEnabled = true; this.lbSrcHost.FormattingEnabled = true;
this.lbSrcHost.ItemHeight = 16; this.lbSrcHost.ItemHeight = 29;
this.lbSrcHost.Location = new System.Drawing.Point(9, 18); this.lbSrcHost.Location = new System.Drawing.Point(20, 185);
this.lbSrcHost.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.lbSrcHost.Name = "lbSrcHost"; this.lbSrcHost.Name = "lbSrcHost";
this.lbSrcHost.Size = new System.Drawing.Size(103, 84); this.lbSrcHost.Size = new System.Drawing.Size(177, 149);
this.lbSrcHost.TabIndex = 0; this.lbSrcHost.TabIndex = 0;
this.lbSrcHost.SelectedIndexChanged += new System.EventHandler(this.lbSrcHost_SelectedIndexChanged); this.lbSrcHost.SelectedIndexChanged += new System.EventHandler(this.lbSrcHost_SelectedIndexChanged);
// //
// lbSrcNic // lbSrcNic
// //
this.lbSrcNic.FormattingEnabled = true; this.lbSrcNic.FormattingEnabled = true;
this.lbSrcNic.ItemHeight = 16; this.lbSrcNic.ItemHeight = 29;
this.lbSrcNic.Location = new System.Drawing.Point(118, 18); this.lbSrcNic.Location = new System.Drawing.Point(210, 185);
this.lbSrcNic.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.lbSrcNic.Name = "lbSrcNic"; this.lbSrcNic.Name = "lbSrcNic";
this.lbSrcNic.Size = new System.Drawing.Size(89, 84); this.lbSrcNic.Size = new System.Drawing.Size(153, 149);
this.lbSrcNic.TabIndex = 1; this.lbSrcNic.TabIndex = 1;
this.lbSrcNic.SelectedIndexChanged += new System.EventHandler(this.lbSrcNic_SelectedIndexChanged); this.lbSrcNic.SelectedIndexChanged += new System.EventHandler(this.lbSrcNic_SelectedIndexChanged);
// //
// lbDstNic // lbDstNic
// //
this.lbDstNic.FormattingEnabled = true; this.lbDstNic.FormattingEnabled = true;
this.lbDstNic.ItemHeight = 16; this.lbDstNic.ItemHeight = 29;
this.lbDstNic.Location = new System.Drawing.Point(399, 18); this.lbDstNic.Location = new System.Drawing.Point(702, 185);
this.lbDstNic.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.lbDstNic.Name = "lbDstNic"; this.lbDstNic.Name = "lbDstNic";
this.lbDstNic.Size = new System.Drawing.Size(89, 84); this.lbDstNic.Size = new System.Drawing.Size(153, 149);
this.lbDstNic.TabIndex = 3; this.lbDstNic.TabIndex = 3;
this.lbDstNic.SelectedIndexChanged += new System.EventHandler(this.lbDstNic_SelectedIndexChanged); this.lbDstNic.SelectedIndexChanged += new System.EventHandler(this.lbDstNic_SelectedIndexChanged);
// //
// lbDstHost // lbDstHost
// //
this.lbDstHost.FormattingEnabled = true; this.lbDstHost.FormattingEnabled = true;
this.lbDstHost.ItemHeight = 16; this.lbDstHost.ItemHeight = 29;
this.lbDstHost.Location = new System.Drawing.Point(290, 18); this.lbDstHost.Location = new System.Drawing.Point(512, 185);
this.lbDstHost.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.lbDstHost.Name = "lbDstHost"; this.lbDstHost.Name = "lbDstHost";
this.lbDstHost.Size = new System.Drawing.Size(103, 84); this.lbDstHost.Size = new System.Drawing.Size(177, 149);
this.lbDstHost.TabIndex = 2; this.lbDstHost.TabIndex = 2;
this.lbDstHost.SelectedIndexChanged += new System.EventHandler(this.lbDstHost_SelectedIndexChanged); this.lbDstHost.SelectedIndexChanged += new System.EventHandler(this.lbDstHost_SelectedIndexChanged);
// //
// btnLink // btnLink
// //
this.btnLink.Location = new System.Drawing.Point(210, 18); this.btnLink.Location = new System.Drawing.Point(372, 185);
this.btnLink.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.btnLink.Name = "btnLink"; this.btnLink.Name = "btnLink";
this.btnLink.Size = new System.Drawing.Size(75, 23); this.btnLink.Size = new System.Drawing.Size(131, 42);
this.btnLink.TabIndex = 4; this.btnLink.TabIndex = 4;
this.btnLink.Text = "Link"; this.btnLink.Text = "Link";
this.btnLink.UseVisualStyleBackColor = true; this.btnLink.UseVisualStyleBackColor = true;
@ -89,9 +98,10 @@
// //
// btnCancel // btnCancel
// //
this.btnCancel.Location = new System.Drawing.Point(210, 47); this.btnCancel.Location = new System.Drawing.Point(372, 237);
this.btnCancel.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.btnCancel.Name = "btnCancel"; this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23); this.btnCancel.Size = new System.Drawing.Size(131, 42);
this.btnCancel.TabIndex = 5; this.btnCancel.TabIndex = 5;
this.btnCancel.Text = "Cancel"; this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true; this.btnCancel.UseVisualStyleBackColor = true;
@ -100,16 +110,37 @@
// cbLinkType // cbLinkType
// //
this.cbLinkType.FormattingEnabled = true; this.cbLinkType.FormattingEnabled = true;
this.cbLinkType.Location = new System.Drawing.Point(210, 76); this.cbLinkType.Location = new System.Drawing.Point(372, 290);
this.cbLinkType.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.cbLinkType.Name = "cbLinkType"; this.cbLinkType.Name = "cbLinkType";
this.cbLinkType.Size = new System.Drawing.Size(75, 24); this.cbLinkType.Size = new System.Drawing.Size(128, 37);
this.cbLinkType.TabIndex = 6; this.cbLinkType.TabIndex = 6;
// //
// pbSource
//
this.pbSource.Location = new System.Drawing.Point(120, 28);
this.pbSource.Name = "pbSource";
this.pbSource.Size = new System.Drawing.Size(167, 149);
this.pbSource.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pbSource.TabIndex = 7;
this.pbSource.TabStop = false;
//
// pbDest
//
this.pbDest.Location = new System.Drawing.Point(607, 28);
this.pbDest.Name = "pbDest";
this.pbDest.Size = new System.Drawing.Size(167, 149);
this.pbDest.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pbDest.TabIndex = 8;
this.pbDest.TabStop = false;
//
// LinkEditor // LinkEditor
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleDimensions = new System.Drawing.SizeF(14F, 29F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(495, 117); this.ClientSize = new System.Drawing.Size(866, 389);
this.Controls.Add(this.pbDest);
this.Controls.Add(this.pbSource);
this.Controls.Add(this.cbLinkType); this.Controls.Add(this.cbLinkType);
this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnLink); this.Controls.Add(this.btnLink);
@ -119,9 +150,12 @@
this.Controls.Add(this.lbSrcHost); this.Controls.Add(this.lbSrcHost);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Icon = global::EduNetworkBuilder.Properties.Resources.NBIco; this.Icon = global::EduNetworkBuilder.Properties.Resources.NBIco;
this.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.Name = "LinkEditor"; this.Name = "LinkEditor";
this.Text = "LinkEditor"; this.Text = "LinkEditor";
this.Shown += new System.EventHandler(this.LinkEditor_Shown); this.Shown += new System.EventHandler(this.LinkEditor_Shown);
((System.ComponentModel.ISupportInitialize)(this.pbSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pbDest)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -135,5 +169,7 @@
private System.Windows.Forms.Button btnLink; private System.Windows.Forms.Button btnLink;
private System.Windows.Forms.Button btnCancel; private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.ComboBox cbLinkType; private System.Windows.Forms.ComboBox cbLinkType;
private System.Windows.Forms.PictureBox pbSource;
private System.Windows.Forms.PictureBox pbDest;
} }
} }

View File

@ -45,6 +45,7 @@ namespace EduNetworkBuilder
lbSrcHost.SelectedIndex = tindex; lbSrcHost.SelectedIndex = tindex;
UpdateDeviceList(); UpdateDeviceList();
} }
pbSource.Image = new Bitmap(Source.GetImage());
} }
if (Dest != null) if (Dest != null)
{ {
@ -54,6 +55,7 @@ namespace EduNetworkBuilder
lbDstHost.SelectedIndex = tindex; lbDstHost.SelectedIndex = tindex;
UpdateDeviceList(); UpdateDeviceList();
} }
pbDest.Image = new Bitmap(Dest.GetImage());
} }
} }

View File

@ -755,6 +755,15 @@ namespace EduNetworkBuilder
} }
} }
/// <summary>
/// Return a copy of the image for this device
/// </summary>
/// <returns></returns>
public Image GetImage()
{
return new Bitmap(MyImage);
}
//This function heavily borrowed from: http://stackoverflow.com/questions/1563038/fast-work-with-bitmaps-in-c-sharp //This function heavily borrowed from: http://stackoverflow.com/questions/1563038/fast-work-with-bitmaps-in-c-sharp
public Image ColoredImage(Image BaseImage) public Image ColoredImage(Image BaseImage)
{ {