Make vlan colors on the outside of the packet
This commit is contained in:
parent
3716fdf234
commit
2094f7fac4
@ -57,7 +57,7 @@ namespace EduNetworkBuilder
|
|||||||
|
|
||||||
private bool previously_had_packets = false; //used on "tick" to determine if we are starting from scratch
|
private bool previously_had_packets = false; //used on "tick" to determine if we are starting from scratch
|
||||||
|
|
||||||
private List<Color> PacketColors = new List<Color>();
|
private List<string> PacketColors = new List<string>();
|
||||||
private List<Image> PacketImages = new List<Image>();
|
private List<Image> PacketImages = new List<Image>();
|
||||||
|
|
||||||
public Network(string Name)
|
public Network(string Name)
|
||||||
@ -1427,20 +1427,25 @@ namespace EduNetworkBuilder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Image GetPacketImage(Color PacketColor)
|
public Image GetPacketImage(Color PacketColor, Color VLANColor)
|
||||||
{
|
{
|
||||||
if(PacketColors.Contains(PacketColor))
|
if (VLANColor == Color.Blue) VLANColor = PacketColor;
|
||||||
|
string ColorNames = PacketColor.Name + VLANColor.Name;
|
||||||
|
if(PacketColors.Contains(ColorNames))
|
||||||
{
|
{
|
||||||
return PacketImages[PacketColors.IndexOf(PacketColor)];
|
return PacketImages[PacketColors.IndexOf(ColorNames)];
|
||||||
}
|
}
|
||||||
PacketColors.Add(PacketColor);
|
PacketColors.Add(ColorNames);
|
||||||
Image newPacketImage = new Bitmap(NB.PacketPixelSize, NB.PacketPixelSize);
|
Image newPacketImage = new Bitmap(NB.PacketPixelSize, NB.PacketPixelSize);
|
||||||
using (Graphics G = Graphics.FromImage(newPacketImage))
|
using (Graphics G = Graphics.FromImage(newPacketImage))
|
||||||
{
|
{
|
||||||
G.Clear(Color.Transparent);
|
G.Clear(Color.Transparent);
|
||||||
// Pen myPen = new Pen(PacketColor, NB.PacketPixelSize);
|
// Pen myPen = new Pen(PacketColor, NB.PacketPixelSize);
|
||||||
Brush tBrush = new SolidBrush(PacketColor);
|
Brush tBrush = new SolidBrush(VLANColor);
|
||||||
G.FillEllipse(tBrush, 0,0, NB.PacketPixelSize, NB.PacketPixelSize);
|
G.FillEllipse(tBrush, 0,0, NB.PacketPixelSize, NB.PacketPixelSize);
|
||||||
|
tBrush = new SolidBrush(PacketColor);
|
||||||
|
int dist = NB.PacketPixelSize / 4;
|
||||||
|
G.FillEllipse(tBrush, dist, dist, NB.PacketPixelSize / 2, NB.PacketPixelSize / 2);
|
||||||
}
|
}
|
||||||
PacketImages.Add(newPacketImage);
|
PacketImages.Add(newPacketImage);
|
||||||
return newPacketImage;
|
return newPacketImage;
|
||||||
|
@ -240,9 +240,9 @@ namespace EduNetworkBuilder
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Color VLANPacketColor = theNet.ColorFromPacketVLAN(VLANID);
|
Color VLANPacketColor = theNet.ColorFromPacketVLAN(VLANID);
|
||||||
if (VLANPacketColor != Color.Blue)
|
//if (VLANPacketColor != Color.Blue)
|
||||||
pencolor = VLANPacketColor;
|
// pencolor = VLANPacketColor;
|
||||||
Image tImage = theNet.GetPacketImage(pencolor);
|
Image tImage = theNet.GetPacketImage(pencolor, VLANPacketColor);
|
||||||
//if (VLANPacketColor != Color.Blue && VLANPacketColor != Color.Empty)
|
//if (VLANPacketColor != Color.Blue && VLANPacketColor != Color.Empty)
|
||||||
//{
|
//{
|
||||||
// tImage = theNet.ColoredImage(tImage, VLANPacketColor);
|
// tImage = theNet.ColoredImage(tImage, VLANPacketColor);
|
||||||
|
Loading…
Reference in New Issue
Block a user