/// <summary> /// Position the label and port relative to the icon. /// </summary> /// <param name="childchanged"></param> /// <remarks> /// Initially the label is positioned below the icon. /// When <see cref="P:Northwoods.Go.GoIconicNode.DraggableLabel" /> is true, the user may select /// and drag the label around independently of the node. /// This class maintains the last known offset of the label with /// respect to the icon, so that this method can place the label /// correctly when <see cref="P:Northwoods.Go.GoIconicNode.DraggableLabel" /> is false or the /// <paramref name="childchanged" /> is not the label. /// When <see cref="P:Northwoods.Go.GoObject.Initializing" /> is true, this method does nothing. /// This method also does nothing if there is no <see cref="P:Northwoods.Go.GoIconicNode.Icon" />. /// </remarks> public override void LayoutChildren(GoObject childchanged) { if (base.Initializing) { return; } GoObject icon = Icon; if (icon == null) { return; } GoText label = Label; if (label != null) { if (DraggableLabel && childchanged == label) { myLabelOffset = new SizeF(label.Left - icon.Left, label.Top - icon.Top); return; } if (myLabelOffset.Width > -99999f) { label.Position = new PointF(icon.Left + myLabelOffset.Width, icon.Top + myLabelOffset.Height); } else { label.SetSpotLocation(32, icon, 128); } } if (Port != null) { Port.SetSpotLocation(1, icon, 1); } }
public override IGoLink CreateLink(IGoPort from, IGoPort to) { IGoLink il = base.CreateLink(from, to); if (il != null) { GoLabeledLink l = il.GoObject as GoLabeledLink; if (l != null) { GraphNode fromNode = from.Node.GoObject as GraphNode; if (fromNode != null && fromNode.Kind == GraphNodeKind.Decision) { GoText t = new GoText(); t.Text = "yes"; t.Selectable = false; t.Editable = true; l.FromLabel = t; } l.Orthogonal = true; l.Style = GoStrokeStyle.RoundedLine; l.ToArrow = true; } } return(il); }
/// <summary> /// Create a GoTextNode with four ports and a <see cref="T:Northwoods.Go.GoDrawing" /> background, /// initialized to have the figure <paramref name="fig" />. /// </summary> /// <param name="fig">a <see cref="T:Northwoods.Go.GoFigure" /> enumeration value</param> /// <remarks> /// This constructor basically does the following, but more efficiently: /// <pre><code> /// GoTextNode n = new GoTextNode(); /// n.Background = new GoDrawing(fig); /// </code></pre> /// </remarks> public GoTextNode(GoFigure fig) { base.InternalFlags &= -17; base.InternalFlags |= 16908288; myBack = new GoDrawing(fig) { Selectable = false, Resizable = false, Reshapable = false, Brush = GoShape.Brushes_LightGray }; Add(myBack); myLabel = CreateLabel(); Add(myLabel); myTopPort = CreatePort(32); Add(myTopPort); myRightPort = CreatePort(64); Add(myRightPort); myBottomPort = CreatePort(128); Add(myBottomPort); myLeftPort = CreatePort(256); Add(myLeftPort); base.Initializing = false; LayoutChildren(null); }
/// <summary> /// If any part is removed from this group, /// be sure to remove any references in local fields. /// </summary> /// <param name="obj"></param> public override bool Remove(GoObject obj) { bool result = base.Remove(obj); if (obj == myBack) { myBack = null; return(result); } if (obj == myLabel) { myLabel = null; return(result); } if (obj == myTopPort) { myTopPort = null; return(result); } if (obj == myRightPort) { myRightPort = null; return(result); } if (obj == myBottomPort) { myBottomPort = null; return(result); } if (obj == myLeftPort) { myLeftPort = null; } return(result); }
// convenience constructor public Message(float step, Lifeline from, Lifeline to, String msg, float actlen, QuickFix.Message m) : this() { this.Step = step; GoText lab = this.FromLabel as GoText; if (lab != null) { lab.Text = msg; } if (from != null) { this.FromPort = from.Port; } if (to != null) { this.ToPort = to.Port; } if (actlen > 0 && to != null) { Activation act = new Activation(); act.Begin = step; act.End = step + actlen; to.Add(act); } FixMessage = m; }
/// <summary> /// If any part is removed from this group, /// be sure to remove any references in local fields. /// </summary> /// <param name="obj"></param> public override bool Remove(GoObject obj) { bool result = base.Remove(obj); if (obj == myIcon) { myIcon = null; return(result); } if (obj == myLabel) { myLabel.RemoveObserver(this); myLabel = null; return(result); } if (obj == myInPort) { myInPort = null; return(result); } if (obj == myOutPort) { myOutPort = null; } return(result); }
public RoadmapSubItem() { Selectable = false; Deletable = false; Orientation = System.Windows.Forms.Orientation.Horizontal; TopLeftMargin = new SizeF(0, 0); BottomRightMargin = new SizeF(0, 0); var t = new GoText { FontSize = 9, AutoResizes = false, Selectable = false, Editable = false, Multiline = true, Wrapping = true, WrappingWidth = 150 }; Add(t); var t2 = new GoText { FontSize = 9, Selectable = false, Editable = false, Multiline = true, Wrapping = true, WrappingWidth = 200 }; Add(t2); }
/// <summary> /// Size the background to fit the text, and position the ports at the edges /// of the background object. /// </summary> /// <param name="childchanged"></param> /// <remarks> /// This method uses the <see cref="P:Northwoods.Go.GoTextNode.TopLeftMargin" /> and <see cref="P:Northwoods.Go.GoTextNode.BottomRightMargin" /> /// properties to decide how much bigger the background should be than the text label. /// This method does nothing if there is no <see cref="P:Northwoods.Go.GoTextNode.Label" />. /// If <see cref="P:Northwoods.Go.GoTextNode.AutoResizes" /> is false, the <see cref="P:Northwoods.Go.GoTextNode.Background" /> object is /// not resized, but the <see cref="P:Northwoods.Go.GoTextNode.Label" />'s bounds and /// <see cref="P:Northwoods.Go.GoText.WrappingWidth" /> are updated according to how much room is /// left inside the <see cref="P:Northwoods.Go.GoTextNode.Background" /> after subtracting the margins. /// </remarks> public override void LayoutChildren(GoObject childchanged) { if (base.Initializing) { return; } GoText label = Label; if (label == null) { return; } GoObject goObject = Background; if (goObject != null) { SizeF topLeftMargin = TopLeftMargin; SizeF bottomRightMargin = BottomRightMargin; if (AutoResizes) { goObject.Bounds = new RectangleF(label.Left - topLeftMargin.Width, label.Top - topLeftMargin.Height, label.Width + topLeftMargin.Width + bottomRightMargin.Width, label.Height + topLeftMargin.Height + bottomRightMargin.Height); } else { float num = Math.Max(goObject.Width - (topLeftMargin.Width + bottomRightMargin.Width), 0f); float num2 = Math.Max(goObject.Height - (topLeftMargin.Height + bottomRightMargin.Height), 0f); label.Width = num; label.WrappingWidth = num; label.UpdateSize(); float num3 = Math.Min(label.Height, num2); float x = goObject.Left + topLeftMargin.Width; float y = goObject.Top + topLeftMargin.Height + (num2 - num3) / 2f; label.Bounds = new RectangleF(x, y, num, num3); } } if (goObject == null && AutoResizes) { goObject = label; } if (goObject != null) { if (TopPort != null) { TopPort.SetSpotLocation(32, goObject, 32); } if (RightPort != null) { RightPort.SetSpotLocation(64, goObject, 64); } if (BottomPort != null) { BottomPort.SetSpotLocation(128, goObject, 128); } if (LeftPort != null) { LeftPort.SetSpotLocation(256, goObject, 256); } } }
/// <summary> /// This convenience method adds an item containing a string to the end of the list. /// </summary> /// <param name="s">the initial <see cref="P:Northwoods.Go.GoText.Text" /> value for the new <see cref="T:Northwoods.Go.GoText" /> item</param> /// <returns>the new <see cref="T:Northwoods.Go.GoText" /> item</returns> /// <remarks> /// This is defined as: /// <pre><code> /// int num = this.ItemCount; /// GoText t = CreateText(s, num); /// AddItem(t, CreatePort(true, num), CreatePort(false, num)); /// return t; /// </code></pre> /// </remarks> public virtual GoText AddString(string s) { int itemCount = ItemCount; GoText goText = CreateText(s, itemCount); AddItem(goText, CreatePort(left: true, itemCount), CreatePort(left: false, itemCount)); return(goText); }
/// <summary> /// Create a GoComment displaying an empty string. /// </summary> /// <remarks> /// This calls <see cref="M:Northwoods.Go.GoComment.CreateBackground" /> and <see cref="M:Northwoods.Go.GoComment.CreateLabel" /> /// to provide initial values for <see cref="P:Northwoods.Go.GoComment.Background" /> and <see cref="P:Northwoods.Go.GoComment.Label" />. /// </remarks> public GoComment() { base.InternalFlags &= -17; myBack = CreateBackground(); Add(myBack); myLabel = CreateLabel(); Add(myLabel); }
protected override GoObject CreateBody() { var container = new GoListGroup { Selectable = false, BrushColor = Color.White, Spacing = 2, TopLeftMargin = new SizeF(0, 0), BottomRightMargin = new SizeF(0, 2), Width = DefaultWidth }; GoListGroup header = new GoListGroup { Orientation = Orientation.Horizontal, Selectable = false, AutoRescales = false, Width = DefaultWidth, Spacing = 2 }; GoText headerText = new GoText { DragsNode = true, Selectable = false, Editable = false, Wrapping = false, AutoRescales = false, AutoResizes = false, StringTrimming = StringTrimming.EllipsisCharacter, FontSize = 9, Width = DefaultWidth - DefaultMargin, TextColor = Color.White, Height = 16 * Dpi.Factor.Height }; header.Add(headerText); GoImage img = new GoImage { Selectable = false, AutoRescales = false, AutoResizes = false, Size = new SizeF(16 * Dpi.Factor.Width, 16 * Dpi.Factor.Height), Visible = false }; header.Add(img); container.Add(header); GoListGroup items = new GoListGroup(); items.Selectable = false; container.Add(items); return(container); }
/// <summary> /// This convenience method sets the string associated with a given item in the list. /// </summary> /// <param name="i"></param> /// <param name="s">a new <see cref="P:Northwoods.Go.GoText.Text" /> value</param> /// <remarks> /// If the <paramref name="i" />'th item is not a <see cref="T:Northwoods.Go.GoText" />, this method does nothing. /// </remarks> public virtual void SetString(int i, string s) { GoText goText = myListGroup[i] as GoText; if (goText != null) { goText.Text = s; } }
private void initializeCommon(string name) { myLabel = CreateLabel(name); Add(myLabel); myPort = CreatePort(); Add(myPort); base.PropertiesDelegatedToSelectionObject = true; base.Initializing = false; LayoutChildren(null); }
/// <summary> /// This method is called when the value of <see cref="P:Northwoods.Go.GoBasicNode.AutoResizes" /> changes. /// </summary> /// <remarks> /// This just changes the <see cref="P:Northwoods.Go.GoBasicNode.Label" />'s <see cref="P:Northwoods.Go.GoText.Wrapping" /> /// and <see cref="P:Northwoods.Go.GoText.Clipping" /> properties to be true when the /// <see cref="P:Northwoods.Go.GoBasicNode.AutoResizes" /> property is false, and vice-versa. /// </remarks> public virtual void OnAutoResizesChanged(bool old) { GoText label = Label; if (label != null) { label.Wrapping = old; label.Clipping = old; } }
/// <summary> /// This convenience method gets the string associated with a given item in the list. /// </summary> /// <param name="i"></param> /// <returns> /// if the <paramref name="i" />'th item is a <see cref="T:Northwoods.Go.GoText" />, /// this returns its <see cref="P:Northwoods.Go.GoText.Text" /> property, /// otherwise it returns an empty string /// </returns> public virtual string GetString(int i) { GoText goText = myListGroup[i] as GoText; if (goText != null) { return(goText.Text); } return(""); }
/// <summary> /// This method is called when the value of <see cref="P:Northwoods.Go.GoTextNode.AutoResizes" /> changes. /// </summary> /// <remarks> /// This just changes the <see cref="P:Northwoods.Go.GoTextNode.Label" />'s <see cref="P:Northwoods.Go.GoText.Wrapping" /> /// and <see cref="P:Northwoods.Go.GoText.Clipping" /> properties to be true when the /// <see cref="P:Northwoods.Go.GoTextNode.AutoResizes" /> property is false, and vice-versa. /// </remarks> public virtual void OnAutoResizesChanged(bool old) { GoText label = Label; if (label != null) { label.Wrapping = old; label.Clipping = old; base.PropertiesDelegatedToSelectionObject = old; } }
public Message() { GoText lab = new GoText(); lab.Selectable = false; lab.Text = "msg"; lab.Editable = true; this.FromLabel = lab; this.ToArrow = true; this.ToArrowShaftLength = 0; }
/// <summary> /// The port is centered in the <see cref="P:Northwoods.Go.GoBasicNode.Shape" />; the <see cref="P:Northwoods.Go.GoBasicNode.Label" /> is positioned according /// to <see cref="P:Northwoods.Go.GoBasicNode.LabelSpot" /> relative to the shape. /// </summary> /// <param name="childchanged"></param> /// <remarks> /// When the <see cref="P:Northwoods.Go.GoBasicNode.LabelSpot" /> is <see cref="F:Northwoods.Go.GoObject.Middle" /> /// and <see cref="P:Northwoods.Go.GoBasicNode.AutoResizes" /> is true, /// we automatically resize the shape to be somewhat larger than the label, /// and we size the port to be the same size as the shape. /// If <see cref="P:Northwoods.Go.GoBasicNode.AutoResizes" /> is false, the <see cref="P:Northwoods.Go.GoBasicNode.Label" /> is /// resized to fit within the <see cref="P:Northwoods.Go.GoBasicNode.Shape" />'s bounds minus the margins. /// Also the <see cref="P:Northwoods.Go.GoBasicNode.Label" />'s <see cref="T:Northwoods.Go.GoText" />.<see cref="P:Northwoods.Go.GoText.WrappingWidth" /> /// is set to the same value as the label's width. /// When the <see cref="P:Northwoods.Go.GoBasicNode.LabelSpot" /> is not <see cref="F:Northwoods.Go.GoObject.Middle" />, /// the label is just positioned relative to the <see cref="P:Northwoods.Go.GoBasicNode.Shape" /> /// according to the <see cref="P:Northwoods.Go.GoBasicNode.LabelSpot" />. /// This method does nothing if there is no <see cref="P:Northwoods.Go.GoBasicNode.Shape" />. /// </remarks> public override void LayoutChildren(GoObject childchanged) { if (base.Initializing) { return; } GoShape shape = Shape; if (shape == null) { return; } GoText label = Label; if (label != null) { if (LabelSpot == 1) { PointF center = shape.Center; SizeF middleLabelMargin = MiddleLabelMargin; if (AutoResizes) { float num = label.Width + middleLabelMargin.Width; float num2 = label.Height + middleLabelMargin.Height; shape.Bounds = new RectangleF(center.X - num / 2f, center.Y - num2 / 2f, num, num2); } else { float num3 = Math.Max(shape.Width - (middleLabelMargin.Width + middleLabelMargin.Width), 0f); float num4 = Math.Max(shape.Height - (middleLabelMargin.Height + middleLabelMargin.Height), 0f); label.Width = num3; label.WrappingWidth = num3; label.UpdateSize(); float num5 = Math.Min(label.Height, num4); float x = shape.Left + middleLabelMargin.Width; float y = shape.Top + middleLabelMargin.Height + (num4 - num5) / 2f; label.Bounds = new RectangleF(x, y, num3, num5); } label.Center = center; if (Port != null) { Port.Bounds = shape.Bounds; } } else { label.SetSpotLocation(SpotOpposite(LabelSpot), shape, LabelSpot); } } if (Port != null) { Port.SetSpotLocation(1, shape, 1); } }
/// <summary> /// Construct a <see cref="T:Northwoods.Go.GoButton" /> with an empty text label and no icon. /// </summary> /// <remarks> /// This calls <see cref="M:Northwoods.Go.GoButton.CreateBackground" />, <see cref="M:Northwoods.Go.GoButton.CreateIcon" />, and /// <see cref="M:Northwoods.Go.GoButton.CreateLabel" /> to provide initial values for this group's /// <see cref="P:Northwoods.Go.GoButton.Background" />, <see cref="P:Northwoods.Go.GoButton.Icon" />, and <see cref="P:Northwoods.Go.GoButton.Label" /> /// properties. /// </remarks> public GoButton() { base.InternalFlags &= -17; base.InternalFlags |= 16777216; myBack = CreateBackground(); Add(myBack); myIcon = CreateIcon(); Add(myIcon); myLabel = CreateLabel(); Add(myLabel); }
public Message(Color color) { _color = color; var lab = new GoText(); lab.Selectable = false; lab.Text = "msg"; lab.Editable = true; FromLabel = lab; ToArrow = true; ToArrowShaftLength = 0; }
/// <summary> /// Create and initialize the <see cref="T:Northwoods.Go.GoText" /> label for displaying the /// comment, which normally supports multiple lines and is editable. /// </summary> /// <returns></returns> /// <example> /// If you override this method, you may want the definition to do /// some of the things that the standard definition does: /// <code> /// protected virtual GoText CreateLabel() { /// GoText l = new GoText(); /// l.Selectable = false; /// l.Multiline = true; /// l.Editable = true; /// this.Editable = true; /// return l; /// } /// </code> /// </example> protected virtual GoText CreateLabel() { GoText result = new GoText { Selectable = false, Multiline = true, Editable = true }; Editable = true; return(result); }
/// <summary> /// Create and initialize a text label. /// </summary> /// <param name="name"></param> /// <returns>a non-editable, non-selectable, middle-aligned, non-rescaling <see cref="T:Northwoods.Go.GoText" /> object</returns> /// <example> /// If you override this method, you may want the definition to do /// some of the things that the standard definition does: /// <code> /// protected virtual GoText CreateLabel(String name) { /// GoText l = null; /// if (name != null) { /// l = new GoText(); /// l.Text = name; /// l.Selectable = this.DraggableLabel; /// l.Alignment = MiddleTop; /// } /// return l; /// } /// </code> /// </example> protected virtual GoText CreateLabel(string name) { GoText goText = null; if (name != null) { goText = new GoText(); goText.Text = name; goText.Selectable = DraggableLabel; goText.Alignment = 32; } return(goText); }
/// <summary> /// The bounds of a balloon comment are just the bounds of the label plus the margins. /// </summary> /// <returns></returns> /// <remarks> /// The bounds do not include the part of the background polygon that points to the anchor. /// </remarks> /// <seealso cref="M:Northwoods.Go.GoBalloon.ExpandPaintBounds(System.Drawing.RectangleF,Northwoods.Go.GoView)" /> protected override RectangleF ComputeBounds() { GoText label = Label; if (label == null) { return(base.ComputeBounds()); } SizeF topLeftMargin = TopLeftMargin; SizeF bottomRightMargin = BottomRightMargin; return(new RectangleF(label.Left - topLeftMargin.Width, label.Top - topLeftMargin.Height, label.Width + topLeftMargin.Width + bottomRightMargin.Width, label.Height + topLeftMargin.Height + bottomRightMargin.Height)); }
/// <summary> /// Position the <see cref="P:Northwoods.Go.GoButton.Icon" /> to the left of the <see cref="P:Northwoods.Go.GoButton.Label" />, /// and surround both with the <see cref="P:Northwoods.Go.GoButton.Background" />, leaving /// <see cref="P:Northwoods.Go.GoButton.TopLeftMargin" /> and <see cref="P:Northwoods.Go.GoButton.BottomRightMargin" /> space /// along the sides. /// </summary> /// <param name="childchanged"></param> public override void LayoutChildren(GoObject childchanged) { if (base.Initializing) { return; } GoObject background = Background; GoText label = Label; GoObject icon = Icon; if (icon != null && label != null) { icon.SetSpotLocation(64, label, 256); } if (background == null) { return; } RectangleF bounds = Bounds; if (label != null) { bounds = label.Bounds; } else { if (icon == null) { return; } bounds = icon.Bounds; } if (icon != null && label != null) { bounds.X -= icon.Width; bounds.Width += icon.Width; if (icon.Height > label.Height) { bounds.Y -= (icon.Height - label.Height) / 2f; bounds.Height = icon.Height; } } SizeF topLeftMargin = TopLeftMargin; SizeF bottomRightMargin = BottomRightMargin; bounds.X -= topLeftMargin.Width; bounds.Width += topLeftMargin.Width + bottomRightMargin.Width; bounds.Y -= topLeftMargin.Height; bounds.Height += topLeftMargin.Height + bottomRightMargin.Height; background.Bounds = bounds; }
/// <summary> /// This convenience method inserts an item containing a string into the list. /// </summary> /// <param name="i">the intended index for the item and its accompanying objects</param> /// <param name="s">the initial <see cref="P:Northwoods.Go.GoText.Text" /> value for the new <see cref="T:Northwoods.Go.GoText" /> item</param> /// <returns>the new <see cref="T:Northwoods.Go.GoText" /> item</returns> /// <remarks> /// This calls <see cref="M:Northwoods.Go.GoMultiTextNode.CreateText(System.String,System.Int32)" /> and <see cref="M:Northwoods.Go.GoMultiTextNode.InsertItem(System.Int32,Northwoods.Go.GoObject,Northwoods.Go.GoObject,Northwoods.Go.GoObject)" /> with /// the resulting <see cref="T:Northwoods.Go.GoText" /> object and the results of two calls to /// <see cref="M:Northwoods.Go.GoMultiTextNode.CreatePort(System.Boolean,System.Int32)" />. /// </remarks> public virtual GoText InsertString(int i, string s) { if (i < 0) { i = 0; } else if (i > ItemCount) { i = ItemCount; } GoText goText = CreateText(s, i); InsertItem(i, goText, CreatePort(left: true, i), CreatePort(left: false, i)); return(goText); }
/// <summary> /// If any part is removed from this group, /// be sure to remove any references in local fields. /// </summary> /// <param name="obj"></param> public override bool Remove(GoObject obj) { bool result = base.Remove(obj); if (obj == myLabel) { myLabel = null; return(result); } if (obj == myBack) { myBack = null; } return(result); }
private void initializeCommon(string name) { myText = name; myLabel = CreateLabel(name); Add(myLabel); if (myLabel != null) { myLabel.AddObserver(this); } myInPort = CreatePort(input: true); Add(myInPort); myOutPort = CreatePort(input: false); Add(myOutPort); base.PropertiesDelegatedToSelectionObject = true; base.Initializing = false; LayoutChildren(null); }
/// <summary> /// Determine how to change the width of all of items in the <see cref="P:Northwoods.Go.GoMultiTextNode.ListGroup" /> /// when the <see cref="P:Northwoods.Go.GoMultiTextNode.ItemWidth" /> changes. /// </summary> /// <param name="old">the former <see cref="P:Northwoods.Go.GoMultiTextNode.ItemWidth" /> value</param> /// <remarks> /// This changes the <see cref="P:Northwoods.Go.GoObject.Width" /> of each item to the new /// <see cref="P:Northwoods.Go.GoMultiTextNode.ItemWidth" /> value, if the new width is positive. /// Furthermore, if the item is an instance of <see cref="T:Northwoods.Go.GoText" />, the /// <see cref="P:Northwoods.Go.GoText.WrappingWidth" /> is set to the same new item width. /// A non-positive value does not change either <see cref="P:Northwoods.Go.GoObject.Width" /> or /// <see cref="P:Northwoods.Go.GoText.WrappingWidth" />. /// You may wish to override this method in order to customize how the /// properties of the items are set when the item width is changed. /// </remarks> public virtual void OnItemWidthChanged(float old) { float itemWidth = ItemWidth; if (!(itemWidth <= 0f)) { foreach (GoObject item in ListGroup) { GoText goText = item as GoText; if (goText != null) { goText.WrappingWidth = itemWidth; } item.Width = itemWidth; } } }
public GraphThreatTypeNode([NotNull] IThreatType threatType) { ThreatType = threatType; Text = threatType.Name; Label = new GoText() { Text = threatType.Name, Selectable = false, Width = 500, Wrapping = false, StringTrimming = StringTrimming.EllipsisCharacter, TextColor = Color.White, FontSize = 9 }; Shape.BrushColor = ThreatModelManager.ThreatsColor; ToolTipText = threatType.Name; }
/// <summary> /// Create and initialize a text item given a string. /// </summary> /// <param name="s"></param> /// <param name="idx"></param> /// <returns>a <see cref="T:Northwoods.Go.GoText" /> object that is the new item</returns> /// <remarks> /// Note that the width of the text object is not set unless /// <see cref="P:Northwoods.Go.GoMultiTextNode.ItemWidth" /> is a positive value. /// </remarks> /// <example> /// If you override this method, you may want the definition to do /// some of the things that the standard definition does: /// <code> /// public virtual GoText CreateText(String s, int idx) { /// GoText t = new GoText(); /// t.Selectable = false; /// t.Alignment = GoObject.Middle; /// t.Multiline = true; /// t.BackgroundOpaqueWhenSelected = true; /// t.BackgroundColor = Color.LightBlue; /// t.DragsNode = true; /// t.Text = s; /// t.Wrapping = true; /// if (this.ItemWidth > 0) { /// t.WrappingWidth = this.ItemWidth; /// t.Width = this.ItemWidth; /// } /// return t; /// } /// </code> /// </example> public virtual GoText CreateText(string s, int idx) { GoText goText = new GoText(); goText.Selectable = false; goText.Alignment = 1; goText.Multiline = true; goText.BackgroundOpaqueWhenSelected = true; goText.BackgroundColor = Color.LightBlue; goText.DragsNode = true; goText.Text = s; goText.Wrapping = true; if (ItemWidth > 0f) { goText.WrappingWidth = ItemWidth; goText.Width = ItemWidth; } return(goText); }
private void CreateLink(XPathNavigator childNav, int linkID, Dictionary<int, DiagramNode> docNodes, int fromID, int toID) { DiagramLink newLink; DiagramNode toNode, fromNode; String firstParam; newLink = new DiagramLink(linkID); newLink.ToArrow = true; newLink.PenWidth = 2; XPathNavigator pnav = childNav.SelectSingleNode("LinkParameters/Parameter/Parameter"); if (pnav != null) { firstParam = "[ " + pnav.GetAttribute("value", pnav.NamespaceURI) + " ]"; GoText label = new GoText(); label.Text = firstParam; label.Selectable = false; newLink.MidLabel = label; } if (docNodes.ContainsKey(toID) && docNodes.ContainsKey(fromID)) { toNode = docNodes[toID]; fromNode = docNodes[fromID]; newLink.ToPort = toNode.Port; newLink.FromPort = fromNode.Port; this.Document.Add(newLink); } }