/// <summary>ビュー座標系に変換された図形をグラフィクスに描き出します。(IVirtualShapeの実装)</summary> /// <param name="g"></param> public override void RenderToView(Graphics g) { PointD c = ParentGraphics.FromGlobalToView(Center); SizeD s = DoesGlobalScale ? new SizeD(Math.Abs(ParentGraphics.ViewScale.W * Radius.W), Math.Abs(ParentGraphics.ViewScale.H * Radius.H)) : Radius; if (s.W == 0 || s.H == 0) { return; } PointD p = c - s; float startAngle = (float)StartAngle, sweepAngle = (float)SweepAngle; if (ParentGraphics.ViewScale.W < 0) { startAngle = 180 - startAngle; sweepAngle = -sweepAngle; } if (ParentGraphics.ViewScale.H < 0) { startAngle = -startAngle; sweepAngle = -sweepAngle; } g.FillPie(ShapeFill, (float)p.X, (float)p.Y, (float)(2.0 * s.W), (float)(2.0 * s.H), startAngle, sweepAngle); g.DrawPie(ShapeBorder, new RectangleF(p, 2 * s), startAngle, sweepAngle); }
/// <summary>ビュー座標系に変換された図形をグラフィクスに描き出します。(IVirtualShapeの実装)</summary> /// <param name="g"></param> public override void RenderToView(Graphics g) { PointD c = ParentGraphics.FromGlobalToView(Center); SizeD s = DoesGlobalScale ? new SizeD(Math.Abs(ParentGraphics.ViewScale.W * Radius.W), Math.Abs(ParentGraphics.ViewScale.H * Radius.H)) : Radius; PointD p = c - s; g.FillEllipse(ShapeFill, new RectangleF(p, 2 * s)); g.DrawEllipse(ShapeBorder, new RectangleF(p, 2 * s)); }
/// <summary>ビュー座標系に変換された図形をグラフィクスに描き出します。(IVirtualShapeの実装)</summary> /// <param name="g"></param> public override void RenderToView(Graphics g) { PointF p = ParentGraphics.FromGlobalToView(Location); g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; g.DrawString(Text, Font, ShapeFill, p); if (DrawFrame) { StringFormat sf = StringFormat.GenericDefault; sf.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces; SizeF s = g.MeasureString(Text, Font, p, sf); g.DrawRectangle(ShapeBorder, p.X - (float)Padding.W, p.Y - (float)Padding.H, s.Width, s.Height); } }
/// <summary>ビュー座標系に変換された多角形をグラフィクスに描き出します。(IVirtualShapeの実装)</summary> /// <param name="g"></param> public override void RenderToView(Graphics g) { if (Vertices == null) { return; } PointF[] v = new PointF[Vertices.Length]; for (int i = 0; i < v.Length; i++) { v[i] = ParentGraphics.FromGlobalToView(Vertices[i]); } g.DrawLines(ShapeBorder, v); }
/// <summary>ビュー座標系に変換された長方形をグラフィクスに描き出します。(IVirtualShapeの実装)</summary> /// <param name="g"></param> public override void RenderToView(Graphics g) { PointF p = ParentGraphics.FromGlobalToView(Location); SizeF s = DoesGlobalScale ? ParentGraphics.ActualViewScale * Size : Size; if (s.Width < 0) { p.X += s.Width; s.Width = -s.Width; } if (s.Height < 0) { p.Y += s.Height; s.Height = -s.Height; } RectangleF r = new RectangleF(p, s); g.FillRectangle(ShapeFill, r); g.DrawRectangles(ShapeBorder, new RectangleF[] { r }); }