public override void Draw(IGraphicsContext gc) { using (gc.PushGraphicsState()) { int depth = CountParentDepth(); Color color = _Colors [depth]; // CountParentDepth is expensive - so don't call StateColor here... Color contactColor = color; if (Name == null || Name.Trim() == "") { color = Color.Red; } gc.Color = color; DrawState(gc, _Bounds.Left, _Bounds.Top, _Bounds.Width, _Bounds.Height, 20, 2 + depth, color, false); gc.Color = contactColor; gc.Thickness = 2 + depth; if (Selected) { foreach (IGlyph contact in ContactPoints) { contact.Draw(gc); } } } }
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); } } }
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 ()) { int depth = CountParentDepth (); Color color = _Colors [depth]; // CountParentDepth is expensive - so don't call StateColor here... Color contactColor = color; if (Name == null || Name.Trim () == "") { color = Color.Red; } gc.Color = color; DrawState (gc, _Bounds.Left, _Bounds.Top, _Bounds.Width, _Bounds.Height, 20, 2+depth, color, false); gc.Color = contactColor; gc.Thickness = 2 + depth; if (Selected) { foreach (IGlyph contact in ContactPoints) { contact.Draw (gc); } } } }