protected void DrawComponent(IGraphicsContext g, int x_left, int y_top, int width, int height, int radius, int thickness, Color color) { GraphicsPath path = new GraphicsPath(); path.StartFigure(); path.AddRectangle(Bounds); if (Selected) { path.AddLine(x_left + 5 + thickness, y_top + height / 2, x_left + 5 + thickness, y_top + radius); path.AddLine(x_left + 5 + thickness, y_top + 5 + thickness, x_left + 5 + thickness + width / 2, y_top + 5 + thickness); path.AddLine(x_left + 5 + thickness + width / 2, y_top + 5 + thickness, x_left + 5 + thickness, y_top + 5 + thickness); } path.CloseFigure(); using (Brush brush = new System.Drawing.SolidBrush(color)) { using (Pen pen = new Pen(brush, thickness)) { g.DrawPath(pen, path); if (IsNotEmptyString(Name)) { g.DrawString(Name, brush, radius, new Point(x_left + radius, y_top + 1), false); } if (IsNotEmptyString(TypeName)) { g.DrawString(TypeName, brush, radius / 2, new Point(x_left + radius, y_top + 1 + radius), false); } } } }
public override void Draw(IGraphicsContext GC) { base.Draw (GC); string s = _PortName; using (Brush brush = new System.Drawing.SolidBrush (Color.Black)) { GC.DrawString (s, brush, 10, new Point (Bounds.Right + 10, Bounds.Top), false); } }
protected void DrawHeading(IGraphicsContext gc) { string s = string.Format("{0}.{1} ver. {2} @ {3}", this.Model.Header.NameSpace, this.Model.Header.Name, this.Model.Header.StateMachineVersion, DateTime.Now.ToString("s")); using (Brush brush = new SolidBrush(Color.Black)) { gc.DrawString(s, brush, 10, new Point(5, 5), false); } }
/// <summary> /// Draw the cell (without borders) at a given location on the graphics context. /// </summary> /// <param name="context">The graphics context to use to draw the cell contents.</param> /// <param name="x">The X coordinate of the top-left corner of the cell.</param> /// <param name="y">The Y coordinate of the top-left corner of the cell.</param> public override void DrawContentsAt(IGraphicsContext context, double x, double y) { if (context is null) { throw new ArgumentNullException(nameof(context)); } double xOffset = (ComputedWidth - MinWidth) / 2 + MarginLeft; context.DrawString(Content, Font, x + xOffset, y + ComputedBaseline); }
public override void Draw(IGraphicsContext GC) { base.Draw(GC); string s = _PortName; using (Brush brush = new System.Drawing.SolidBrush(Color.Black)) { GC.DrawString(s, brush, 10, new Point(Bounds.Right + 10, Bounds.Top), false); } }
/// <summary> /// Draw the word at a particular location in a given context. /// </summary> /// <param name="context">The context to use to draw the word.</param> /// <param name="x">The x-coordinate of the top left corner of the word.</param> /// <param name="y">The y-coordinate of the top left corner of the word.</param> public void DrawAt(IGraphicsContext context, double x, double y) { if (context is null) { throw new ArgumentNullException(nameof(context)); } double computedY = y + ComputedBaseline; Log.Trace("Drawing '{0}' at {1}, {2}", Content, x, computedY); context.DrawString(Content, Font, x, computedY); }
public override void Draw(IGraphicsContext GC) { Color oldColor = GC.Color; Color primary = Color.Orchid; if (!IsNotEmptyString(FromPortName) || !IsNotEmptyString(ToPortName) /* || !IsNotEmptyString (Interface) */) { primary = Color.Red; } GC.Color = primary; if (Selected) { GC.Thickness = 5; } else { GC.Thickness = 2; } GC.DrawLine(_From, _To); foreach (IPortLinkContactPointGlyph contact in ContactPoints) { switch (contact.WhichEnd) { case TransitionContactEnd.From: GC.Thickness = 3; break; case TransitionContactEnd.To: GC.Thickness = 5; break; default: throw new NotSupportedException("Unknown TransitionContactEnd: " + contact.WhichEnd.ToString()); } IComponentGlyph component = contact.Parent as IComponentGlyph; if (component != null) { GC.Color = component.ComponentColor; contact.Draw(GC); } else { GC.Color = primary; contact.Draw(GC); } } string s = DisplayText(); using (Brush brush = new System.Drawing.SolidBrush(Color.Black)) { GC.DrawString(s, brush, 10, new Point((_To.X + _From.X) / 2, (_To.Y + _From.Y) / 2), true); } GC.Color = oldColor; }
public override void Draw(IGraphicsContext GC) { Color oldColor = GC.Color; Color primary = Color.Orchid; if (Interface == null || Interface.Trim() == "") { primary = Color.Red; } GC.Color = primary; if (Selected) { GC.Thickness = 5; } else { GC.Thickness = 2; } GC.DrawLine(_From, _To); foreach (OperationPortLinkContactPointGlyph contact in ContactPoints) { switch (contact.WhichEnd) { case TransitionContactEnd.From: GC.Thickness = 3; break; case TransitionContactEnd.To: GC.Thickness = 5; break; default: throw new NotSupportedException("Unknown TransitionContactEnd: " + contact.WhichEnd.ToString()); } IOperationGlyph operation = contact.Parent as IOperationGlyph; if (operation != null) { GC.Color = primary; // FIXUP: operation.OperationColor; contact.Draw(GC); } else { GC.Color = primary; contact.Draw(GC); } } string s = DisplayText(); using (Brush brush = new System.Drawing.SolidBrush(Color.Black)) { GC.DrawString(s, brush, 10, new Point((_To.X + _From.X) / 2, (_To.Y + _From.Y) / 2), true); } GC.Color = oldColor; }
public override void Draw(IGraphicsContext GC) { using (GC.PushGraphicsState()) { bool isOk; bool usePrimary; Color primary; DashStyle dashStyle; usePrimary = PrimaryInformation(out isOk, out primary, out dashStyle); GC.Color = primary; int thickness = 2; if (Selected) { thickness = 5; } Color fromColor; Color toColor; DrawContactPoints(GC, isOk, usePrimary, primary, out fromColor, out toColor); GC.Thickness = thickness; GC.DrawLine(_From, _To, fromColor, toColor, dashStyle); ArrayList contextList = GetDisplayTextAsContextList(GC); int startX = (_To.X + _From.X) / 2; int startY = (_To.Y + _From.Y) / 2; bool isMoreHorizontal = Math.Abs(_To.X - _From.X) > Math.Abs(_To.Y - _From.Y); bool positiveWidthAdjust; bool positiveHeightAdjust; if (isMoreHorizontal) { positiveWidthAdjust = false; positiveHeightAdjust = true; } else { positiveWidthAdjust = false; positiveHeightAdjust = false; } GC.DrawString(contextList, new Point(startX, startY), positiveWidthAdjust, positiveHeightAdjust, true); } }
public override void Draw(IGraphicsContext GC) { using (GC.PushGraphicsState()) { string name = Name; if (IsNotEmptyString(name)) { GC.Color = Color.Orange; } else { name = "NoName"; GC.Color = Color.Red; } base.Draw(GC); using (Brush brush = new SolidBrush(GC.Color)) { Rectangle bounds = Bounds; Point centre = new Point(bounds.X + bounds.Width / 2, bounds.Y + bounds.Height / 2); GC.DrawString(name, brush, 10, centre, true); } } }
public override void Draw(IGraphicsContext GC) { using (GC.PushGraphicsState ()) { string name = Name; if (IsNotEmptyString (name)) { GC.Color = Color.Orange; } else { name = "NoName"; GC.Color = Color.Red; } base.Draw (GC); using (Brush brush = new SolidBrush (GC.Color)) { Rectangle bounds = Bounds; Point centre = new Point (bounds.X + bounds.Width / 2, bounds.Y + bounds.Height / 2); GC.DrawString (name, brush, 10, centre, true); } } }
protected void DrawComponent (IGraphicsContext g, int x_left, int y_top, int width, int height, int radius, int thickness, Color color) { GraphicsPath path = new GraphicsPath (); path.StartFigure (); path.AddRectangle (Bounds); if (Selected) { path.AddLine (x_left + 5 + thickness, y_top + height / 2, x_left + 5 + thickness, y_top + radius); path.AddLine (x_left + 5 + thickness, y_top + 5 + thickness, x_left + 5 + thickness + width / 2, y_top + 5 + thickness); path.AddLine (x_left + 5 + thickness + width / 2, y_top + 5 + thickness, x_left + 5 + thickness, y_top + 5 + thickness); } path.CloseFigure (); using (Brush brush = new System.Drawing.SolidBrush (color)) { using (Pen pen = new Pen (brush, thickness)) { g.DrawPath (pen, path); if (Name != null && Name.Trim () != "") { g.DrawString (Name, brush, radius, new Point (x_left + radius, y_top + 1), false); } } } }
protected void DrawHeading(IGraphicsContext gc) { string s = string.Format ("{0}.{1} ver. {2} @ {3}", this.Model.Header.NameSpace, this.Model.Header.Name, this.Model.Header.StateMachineVersion, DateTime.Now.ToString ("s")); using (Brush brush = new SolidBrush (Color.Black)) { gc.DrawString (s, brush, 10, new Point (5, 5), false); } }
public override void Draw(IGraphicsContext GC) { using (GC.PushGraphicsState ()) { bool isOk; bool usePrimary; Color primary; DashStyle dashStyle; usePrimary = PrimaryInformation (out isOk, out primary, out dashStyle); GC.Color = primary; int thickness = 2; if (Selected) { thickness = 5; } Color fromColor; Color toColor; DrawContactPoints (GC, isOk, usePrimary, primary, out fromColor, out toColor); GC.Thickness = thickness; GC.DrawLine (_From, _To, fromColor, toColor, dashStyle); ArrayList contextList = GetDisplayTextAsContextList (GC); int startX = (_To.X + _From.X) / 2; int startY = (_To.Y + _From.Y) / 2; bool isMoreHorizontal = Math.Abs (_To.X - _From.X) > Math.Abs (_To.Y - _From.Y); bool positiveWidthAdjust; bool positiveHeightAdjust; if (isMoreHorizontal) { positiveWidthAdjust = false; positiveHeightAdjust = true; } else { positiveWidthAdjust = false; positiveHeightAdjust = false; } GC.DrawString (contextList, new Point (startX, startY), positiveWidthAdjust, positiveHeightAdjust, true); } }
public override void Draw(IGraphicsContext GC) { Color oldColor = GC.Color; Color primary = Color.Orchid; if (Interface == null || Interface.Trim () == "") { primary = Color.Red; } GC.Color = primary; if (Selected) { GC.Thickness = 5; } else { GC.Thickness = 2; } GC.DrawLine (_From, _To); foreach (OperationPortLinkContactPointGlyph contact in ContactPoints) { switch (contact.WhichEnd) { case TransitionContactEnd.From: GC.Thickness = 3; break; case TransitionContactEnd.To: GC.Thickness = 5; break; default: throw new NotSupportedException ("Unknown TransitionContactEnd: " + contact.WhichEnd.ToString ()); } IOperationGlyph operation = contact.Parent as IOperationGlyph; if (operation != null) { GC.Color = primary; // FIXUP: operation.OperationColor; contact.Draw (GC); } else { GC.Color = primary; contact.Draw (GC); } } string s = DisplayText (); using (Brush brush = new System.Drawing.SolidBrush (Color.Black)) { GC.DrawString (s, brush, 10, new Point ((_To.X + _From.X) / 2, (_To.Y + _From.Y) / 2), true); } GC.Color = oldColor; }
protected void DrawString(IGraphicsContext g, string s, Brush brush, int thickness, Point point, FontStyle fontStyle) { IDrawStringContext context = new DrawStringContext(s, thickness, StateColor, fontStyle); g.DrawString(context, brush, point, false); }
public override void Draw(IGraphicsContext GC) { Color oldColor = GC.Color; Color primary = Color.Orchid; if (!IsNotEmptyString (FromPortName) || !IsNotEmptyString (ToPortName) /* || !IsNotEmptyString (Interface) */) { primary = Color.Red; } GC.Color = primary; if (Selected) { GC.Thickness = 5; } else { GC.Thickness = 2; } GC.DrawLine (_From, _To); foreach (IPortLinkContactPointGlyph contact in ContactPoints) { switch (contact.WhichEnd) { case TransitionContactEnd.From: GC.Thickness = 3; break; case TransitionContactEnd.To: GC.Thickness = 5; break; default: throw new NotSupportedException ("Unknown TransitionContactEnd: " + contact.WhichEnd.ToString ()); } IComponentGlyph component = contact.Parent as IComponentGlyph; if (component != null) { GC.Color = component.ComponentColor; contact.Draw (GC); } else { GC.Color = primary; contact.Draw (GC); } } string s = DisplayText (); using (Brush brush = new System.Drawing.SolidBrush (Color.Black)) { GC.DrawString (s, brush, 10, new Point ((_To.X + _From.X) / 2, (_To.Y + _From.Y) / 2), true); } GC.Color = oldColor; }
protected void DrawString(IGraphicsContext g, string s, Brush brush, int thickness, Point point, FontStyle fontStyle) { IDrawStringContext context = new DrawStringContext (s, thickness, StateColor, fontStyle); g.DrawString (context, brush, point, false); }