public override void Draw(Graphics g) { Pen pen = new Pen(Color, PenWidth); Brush brushin = null; brushin = new SolidBrush(Color.FromArgb(255, 0, 255, 0)); g.SmoothingMode = SmoothingMode.AntiAlias; Rectangle frect = new Rectangle(Rectangle.X, Rectangle.Y, Rectangle.Width, Rectangle.Height); g.FillRectangle(brushin, frect); //填充区域 g.DrawRectangle(pen, Rectangle); //画外框 Rectangle zrect = new Rectangle(frect.X + (frect.Width - 10) / 2, frect.Y + (frect.Height - 10) / 2, frect.Width, frect.Height); Brush brushin0 = new SolidBrush(Color.Black); StringFormat style = new StringFormat(); style.Alignment = StringAlignment.Near; if (true) { g.DrawString( PortID.ToString(), new Font("宋体", 10, FontStyle.Regular), brushin0, zrect, style); } pen.Dispose(); }
public override void OnWriteToXmlNode(IXmlCodeWriter serializer, XmlNode node) { base.OnWriteToXmlNode(serializer, node); XmlSerialization.SetAttribute(node, XmlSerialization.XMLATT_ID, PortID.ToString()); XmlSerialization.SetAttribute(node, XmlSerialization.XMLATT_DataLinkType, _linkType); if (_property != null) { XmlSerialization.WriteToChildXmlNode(serializer, node, ProgramEntity.XML_PortProperty, _property); } }
public void AddPort() { GameObject newPortButton = Instantiate(portButton, Vector3.zero, Quaternion.identity, portButton.transform.parent) as GameObject; PortID identity = newPortButton.GetComponent <PortID>(); identity.UpdatePort("game", 8080, ProtocolType.TCP); EditPort(identity); newPortButton.SetActive(true); }
public void EditPort(PortID identifier) { editPortID = identifier; for (int i = 0; i < portDropdown.options.Count; i++) { if (portDropdown.options[i].text.Equals(identifier.protocol.ToString())) { portDropdown.value = i; portDropdown.RefreshShownValue(); } } portNameField.text = identifier.portName.ToString(); portNumberField.text = identifier.number.ToString(); editPortWindow.SetActive(true); }
public void DeletePort(PortID identifier) { Destroy(identifier.gameObject); }
public override void OnWriteToXmlNode(IXmlCodeWriter serializer, XmlNode node) { base.OnWriteToXmlNode(serializer, node); XmlSerialization.SetAttribute(node, XmlSerialization.XMLATT_ID, PortID.ToString()); XmlSerialization.WriteToUniqueChildXmlNode(serializer, node, ProgramEntity.XML_PortProperty, _property); }