// Clean up managed resources. public void Dispose() { Console.WriteLine("Disposing the Managed Resources"); // If we've already run Dispose, do nothing. if (IsDisposed) { return; } // Dispose of FillBrush and OutlinePen. FillBrush.Dispose(); OutlinePen.Dispose(); // Remember that we ran Dispose. IsDisposed = true; }
public override void Paint(Graphics g, IPaintContext paintContext) { GraphicsState gs = g.Save(); TransformGraphics(g); var bounds = Bounds; var path = InternalGetPath(bounds.LeftTop); Pen.SetEnvironment((RectangleF)bounds, BrushX.GetEffectiveMaximumResolution(g, Math.Max(ScaleX, ScaleY))); g.DrawPath(Pen, path); if (_outlinePen != null && _outlinePen.IsVisible) { path.Widen(Pen); OutlinePen.SetEnvironment((RectangleF)bounds, BrushX.GetEffectiveMaximumResolution(g, Math.Max(ScaleX, ScaleY))); g.DrawPath(OutlinePen, path); } g.Restore(gs); }
public override void Paint(Graphics g, IPaintContext paintContext) { GraphicsState gs = g.Save(); TransformGraphics(g); var bounds = Bounds; Pen.SetEnvironment((RectangleF)bounds, BrushX.GetEffectiveMaximumResolution(g, Math.Max(ScaleX, ScaleY))); g.DrawLine(Pen, (float)bounds.X, (float)bounds.Y, (float)bounds.Right, (float)bounds.Bottom); if (_outlinePen != null && _outlinePen.IsVisible) { var p = new GraphicsPath(); p.AddLine((float)bounds.X, (float)bounds.Y, (float)bounds.Right, (float)bounds.Bottom); p.Widen(Pen); OutlinePen.SetEnvironment((RectangleF)bounds, BrushX.GetEffectiveMaximumResolution(g, Math.Max(ScaleX, ScaleY))); g.DrawPath(OutlinePen, p); } g.Restore(gs); }