本文整理汇总了C#中PdfSharp.Drawing.XGraphics.DrawEllipse方法的典型用法代码示例。如果您正苦于以下问题:C# XGraphics.DrawEllipse方法的具体用法?C# XGraphics.DrawEllipse怎么用?C# XGraphics.DrawEllipse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PdfSharp.Drawing.XGraphics
的用法示例。
在下文中一共展示了XGraphics.DrawEllipse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderPage
/// <summary>
/// Demonstrates the use of XGraphics.DrawBeziers.
/// </summary>
public override void RenderPage(XGraphics gfx)
{
base.RenderPage(gfx);
int n = 2;
int count = 1 + 3 * n;
XPoint[] points = new XPoint[count];
Random rnd = new Random(42);
for (int idx = 0; idx < count; idx++)
{
points[idx].X = 20 + rnd.Next(600);
points[idx].Y = 50 + rnd.Next(800);
}
// Draw the points
XPen pen = new XPen(XColors.Red, 0.5);
pen.DashStyle = XDashStyle.Dash;
for (int idx = 0; idx + 3 < count; idx += 3)
{
gfx.DrawEllipse(XBrushes.Red, MakeRect(points[idx]));
gfx.DrawEllipse(XBrushes.Red, MakeRect(points[idx + 1]));
gfx.DrawEllipse(XBrushes.Red, MakeRect(points[idx + 2]));
gfx.DrawEllipse(XBrushes.Red, MakeRect(points[idx + 3]));
gfx.DrawLine(pen, points[idx], points[idx + 1]);
gfx.DrawLine(pen, points[idx + 2], points[idx + 3]);
}
// Draw the curve
gfx.DrawBeziers(properties.Pen2.Pen, points);
}
示例2: DrawEllipse
public static void DrawEllipse(XGraphics gfx, int number)
{
// BeginBox(gfx, number, "DrawEllipse");
XPen pen = new XPen(XColors.DarkBlue, 2.5);
gfx.DrawEllipse(pen, 10, 0, 100, 60);
gfx.DrawEllipse(XBrushes.Goldenrod, 130, 0, 100, 60);
gfx.DrawEllipse(pen, XBrushes.Goldenrod, 10, 80, 100, 60);
gfx.DrawEllipse(pen, XBrushes.Goldenrod, 150, 80, 60, 60);
EndBox(gfx);
}
示例3: RenderPage
/// <summary>
/// Demonstrates the use of XGraphics.DrawRoundedRectangle.
/// </summary>
public override void RenderPage(XGraphics gfx)
{
base.RenderPage(gfx);
// Stroke ellipse
gfx.DrawEllipse(properties.Pen1.Pen, 50, 100, 450, 150);
// Fill ellipse
gfx.DrawEllipse(properties.Brush2.Brush, new Rectangle(50, 300, 450, 150));
// Stroke and fill ellipse
gfx.DrawEllipse(properties.Pen2.Pen, properties.Brush2.Brush, new RectangleF(50, 500, 450, 150));
// Stroke circle
gfx.DrawEllipse(properties.Pen2.Pen, new XRect(100, 200, 400, 400));
#if DEBUG
int count = 360;
XPoint[] circle = new XPoint[count];
for (int idx = 0; idx < count; idx++)
{
double rad = idx * 2 * Math.PI / count;
circle[idx].X = Math.Cos(rad) * 200 + 300;
circle[idx].Y = Math.Sin(rad) * 200 + 400;
}
gfx.DrawPolygon(properties.Pen3.Pen, circle);
#endif
}
示例4: RenderPage
/// <summary>
/// Demonstrates the use of XGraphics.SetClip.
/// </summary>
public override void RenderPage(XGraphics gfx)
{
base.RenderPage(gfx);
gfx.Save();
gfx.TranslateTransform(50, 50);
gfx.IntersectClip(new Rectangle(0, 0, 400, 250));
gfx.TranslateTransform(50, 50);
//gfx.Clear(XColor.GhostWhite);
gfx.DrawEllipse(XPens.Green, XBrushes.Yellow, 40, 40, 500, 500);
gfx.Restore();
gfx.Save();
//gfx.Transform = new XMatrix(); //XMatrix.Identity;
gfx.TranslateTransform(200, 200);
gfx.IntersectClip(new Rectangle(0, 0, 400, 250));
gfx.DrawEllipse(XPens.Green, XBrushes.Yellow, 40, 40, 500, 500);
gfx.Restore();
}
示例5: RenderPage
/// <summary>
/// Demonstrates the use of XGraphics.DrawBezier.
/// </summary>
public override void RenderPage(XGraphics gfx)
{
base.RenderPage(gfx);
gfx.DrawEllipse(XBrushes.Red, MakeRect(50, 100));
gfx.DrawEllipse(XBrushes.Red, MakeRect(450, 100));
gfx.DrawEllipse(XBrushes.Red, MakeRect(550, 190));
gfx.DrawEllipse(XBrushes.Red, MakeRect(150, 300));
gfx.DrawLine(XPens.Red, 50, 100, 450, 100);
gfx.DrawLine(XPens.Red, 550, 190, 150, 300);
gfx.DrawBezier(properties.Pen2.Pen, 50, 100, 450, 100, 550, 190, 150, 300);
//XPoint[] points = new XPoint[1 + 3 * 3];
//Random rnd = new Random();
//for (int idx = 0; idx < points.Length; idx++)
//{
// points[idx].X = 100 + rnd.Next(400);
// points[idx].Y = 200 + rnd.Next(700);
//}
//gfx.DrawBeziers(properties.Pen1.Pen, points);
}
示例6: RenderPage
/// <summary>
/// Source and more infos: http://www.math.dartmouth.edu/~dlittle/java/SpiroGraph/
/// </summary>
public override void RenderPage(XGraphics gfx)
{
base.RenderPage(gfx);
//int R = 60, r = 60, p = 60, N = 270; // Cardioid
//int R = 60, r = -45, p = -101, N = 270; // Rounded Square
//int R = 75, r = -25, p = 85, N = 270; // Gold fish
//int R = 75, r = -30, p = 60, N = 270; // Star fish
//int R = 100, r = 49, p = 66, N = 7; // String of Pearls
//int R = 90, r = 1, p = 105, N = 105; // Rotating Triangle
//int R = 90, r = 1, p = 105, N = 105;
int R = 60, r = 2, p = 122, N = 490;
int revs = Math.Abs(r) / Gcd(R, Math.Abs(r));
XPoint[] points = new XPoint[revs * N + 1];
for (int i = 0; i <= revs * N; i++)
{
double t = 4 * i * Math.PI / N;
points[i].X = ((R+r)*Math.Cos(t) - p * Math.Cos((R+r)* t / r));
points[i].Y = ((R+r)*Math.Sin(t) - p * Math.Sin((R+r)* t / r));
}
#if true
// Draw as lines
gfx.TranslateTransform(300, 250);
gfx.DrawLines(properties.Pen2.Pen, points);
//gfx.DrawPolygon(properties.Pen2.Pen, properties.Brush2.Brush, points, properties.General.FillMode);
// Draw as closed curve
gfx.TranslateTransform(0, 400);
gfx.DrawClosedCurve(properties.Pen2.Pen, properties.Brush2.Brush, points, properties.General.FillMode,
properties.General.Tension);
#else
gfx.TranslateTransform(300, 400);
XSolidBrush dotBrush = new XSolidBrush(properties.Pen2.Pen.Color);
float width = properties.Pen2.Width;
for (int i = 0; i < revs * N; i++)
gfx.DrawEllipse(dotBrush,points[i].X, points[i].Y, width, width);
#endif
}
示例7: DrawEllipseInternal
/// <summary>
///
/// </summary>
/// <param name="gfx"></param>
/// <param name="brush"></param>
/// <param name="pen"></param>
/// <param name="isStroked"></param>
/// <param name="isFilled"></param>
/// <param name="rect"></param>
private static void DrawEllipseInternal(
XGraphics gfx,
XSolidBrush brush,
XPen pen,
bool isStroked,
bool isFilled,
ref XRect rect)
{
if (isStroked && isFilled)
{
gfx.DrawEllipse(pen, brush, rect);
}
else if (isStroked && !isFilled)
{
gfx.DrawEllipse(pen, rect);
}
else if (!isStroked && isFilled)
{
gfx.DrawEllipse(brush, rect);
}
}
示例8: Paint
public void Paint(XGraphics graphics, RectangleF rect, MapOptions options, Color dotColor, XBrush labelBrush, XFont labelFont)
{
if (graphics == null)
throw new ArgumentNullException("graphics");
Point pt = Astrometrics.LocationToCoordinates(Location);
using (RenderUtil.SaveState(graphics))
{
graphics.SmoothingMode = XSmoothingMode.HighSpeed;
graphics.TranslateTransform(pt.X, pt.Y);
graphics.ScaleTransform(1.0f / Astrometrics.ParsecScaleX, 1.0f / Astrometrics.ParsecScaleY);
const float radius = 3;
XBrush brush = new XSolidBrush(dotColor);
XPen pen = new XPen(dotColor);
graphics.DrawEllipse(brush, -radius / 2, -radius / 2, radius, radius);
graphics.SmoothingMode = XSmoothingMode.HighQuality;
graphics.DrawEllipse(pen, -radius / 2, -radius / 2, radius, radius);
XStringFormat format = (LabelBiasX == -1) ? RenderUtil.StringFormatTopRight :
(LabelBiasX == 1) ? RenderUtil.StringFormatTopLeft : RenderUtil.StringFormatTopCenter;
XSize size = graphics.MeasureString(Name, labelFont);
XPoint pos = new XPoint(0, 0);
//pos.X += ( LabelBiasX * radius / 2 ) + ( -size.Width * ( 1 - LabelBiasX ) / 2.0f );
pos.Y += (LabelBiasY * radius / 2) + (-size.Height * (1 - LabelBiasY) / 2.0f);
pos.X += (LabelBiasX * radius / 2);
//pos.Y += ( LabelBiasY * radius / 2 );
graphics.DrawString(Name, labelFont, labelBrush, pos.X, pos.Y, format);
}
}
示例9: DrawSecondHand
void DrawSecondHand(XGraphics gfx, XPen pen)
{
XGraphicsState gs = gfx.Save();
gfx.RotateTransform(360 * Time.Second / 60 + 6 * Time.Millisecond / 1000);
gfx.DrawEllipse(new XSolidBrush(pen.Color), -15, -15, 30, 30);
gfx.DrawLine(pen, 0, 40, 0, -800);
gfx.Restore(gs);
}
示例10: DrawFace
static void DrawFace(XGraphics gfx, XPen pen, XBrush brush)
{
for (int i = 0; i < 60; i++)
{
int size = i % 5 == 0 ? 100 : 30;
gfx.DrawEllipse(pen, brush, 0 - size / 2, -900 - size / 2, size, size);
gfx.RotateTransform(6);
}
}
示例11: DrawVertex
private static void DrawVertex(XGraphics g, string v, LayoutProvider layout, NetworkColorizer colorizer)
{
OpenTK.Vector3 p = layout.GetPositionOfNode(v);
double size = Renderer.ComputeNodeSize(v);
if (!double.IsNaN(p.X) &&
!double.IsNaN(p.Y) &&
!double.IsNaN(p.Z))
g.DrawEllipse(new SolidBrush(colorizer[v]), p.X - size / 2d - x_offset, p.Y - size / 2d - y_offset, size, size);
}
示例12: DrawHandle
public static void DrawHandle(Canvas canvas, XGraphics graphics, Palette palette, Rect bounds, DrawingContext context, bool alwaysAlpha, bool round)
{
if (bounds.Width <= 0 || bounds.Height <= 0)
{
return;
}
using (var quality = new Smoothing(graphics, XSmoothingMode.Default))
{
XBrush brush;
Pen pen;
var alpha = 180;
if (context.Selected)
{
if (!alwaysAlpha)
{
alpha = 255;
}
brush = palette.Gradient(bounds, Color.FromArgb(alpha, Color.LemonChiffon), Color.FromArgb(alpha, Color.DarkOrange));
pen = palette.Pen(Color.FromArgb(alpha, Color.Chocolate), 0);
}
else
{
brush = palette.Gradient(bounds, Color.FromArgb(alpha, Color.LightCyan), Color.FromArgb(alpha, Color.SteelBlue));
pen = palette.Pen(Color.FromArgb(alpha, Color.Navy), 0);
}
if (round)
{
graphics.DrawEllipse(brush, bounds.ToRectangleF());
graphics.DrawEllipse(pen, bounds.ToRectangleF());
}
else
{
graphics.DrawRectangle(brush, bounds.ToRectangleF());
graphics.DrawRectangle(pen, bounds.ToRectangleF());
}
}
}
示例13: DrawVertex
private static void DrawVertex(XGraphics g, Vertex v, LayoutProvider layout, NetworkColorizer colorizer)
{
Vector3 p = layout.GetPositionOfNode(v);
double size = ComputeNodeSize(v);
if (!double.IsNaN(p.X) &&
!double.IsNaN(p.Y) &&
!double.IsNaN(p.Z))
g.DrawEllipse(new SolidBrush(colorizer[v]), p.X - size/2d, p.Y - size/2d, size, size);
}
示例14: DrawVertex
private static void DrawVertex(XGraphics g, Vertex v, LayoutProvider layout, NetworkColorizer colorizer)
{
Vector3 p = layout.GetPositionOfNode(v);
double size = Math.Min(2f, Math.Max(0.05d, Math.Log10(v.Degree)));
if (!double.IsNaN(p.X) &&
!double.IsNaN(p.Y) &&
!double.IsNaN(p.Z))
g.DrawEllipse(new SolidBrush(colorizer[v]), p.X - size/2d, p.Y - size/2d, size, size);
}
示例15: DrawEllipse
private void DrawEllipse(XGraphics gfx, IEllipse ellipse)
{
double x = Math.Min(ellipse.Point1.X, ellipse.Point2.X);
double y = Math.Min(ellipse.Point1.Y, ellipse.Point2.Y);
double width = Math.Abs(ellipse.Point2.X - ellipse.Point1.X);
double height = Math.Abs(ellipse.Point2.Y - ellipse.Point1.Y);
if (ellipse.Fill.A > 0x00)
{
var pen = new XPen(
ToXColor(ellipse.Stroke),
X(ellipse.StrokeThickness));
var brush = new XSolidBrush(ToXColor(ellipse.Fill));
gfx.DrawEllipse(
pen,
brush,
X(x),
Y(y),
X(width),
Y(height));
}
else
{
var pen = new XPen(
ToXColor(ellipse.Stroke),
X(ellipse.StrokeThickness));
gfx.DrawEllipse(
pen,
X(x),
Y(y),
X(width),
Y(height));
}
}