本文整理汇总了C#中PdfSharp.Drawing.XPen类的典型用法代码示例。如果您正苦于以下问题:C# XPen类的具体用法?C# XPen怎么用?C# XPen使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XPen类属于PdfSharp.Drawing命名空间,在下文中一共展示了XPen类的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: RenderArcs
/// <summary>
/// Draws Arcs.
/// </summary>
void RenderArcs(XGraphics gfx)
{
gfx.TranslateTransform(15, 20);
XPen pen = new XPen(XColors.Plum, 4.7);
gfx.DrawArc(pen, 0, 0, 250, 140, 190, 200);
}
示例3: RenderLines
/// <summary>
/// Draws simple lines.
/// </summary>
void RenderLines(XGraphics gfx)
{
gfx.TranslateTransform(15, 20);
gfx.DrawLine(XPens.Red, new XPoint(10, 10), new XPoint(300, 300));
gfx.DrawLine(XPens.DarkGreen, 0, 0, 250, 0);
gfx.DrawLine(XPens.Gold, 15, 7, 230, 15);
XPen pen = new XPen(XColors.Navy, 4);
gfx.DrawLine(pen, 0, 20, 250, 20);
pen = new XPen(XColors.Firebrick, 6);
pen.DashStyle = XDashStyle.Dash;
gfx.DrawLine(pen, 0, 40, 250, 40);
pen.Width = 7.3;
pen.DashStyle = XDashStyle.DashDotDot;
gfx.DrawLine(pen, 0, 60, 250, 60);
pen = new XPen(XColors.Goldenrod, 10);
pen.LineCap = XLineCap.Flat;
gfx.DrawLine(pen, 10, 90, 240, 90);
gfx.DrawLine(XPens.Black, 10, 90, 240, 90);
pen = new XPen(XColors.Goldenrod, 10);
pen.LineCap = XLineCap.Square;
gfx.DrawLine(pen, 10, 110, 240, 110);
gfx.DrawLine(XPens.Black, 10, 110, 240, 110);
pen = new XPen(XColors.Goldenrod, 10);
pen.LineCap = XLineCap.Round;
gfx.DrawLine(pen, 10, 130, 240, 130);
gfx.DrawLine(XPens.Black, 10, 130, 240, 130);
}
示例4: RenderClock
/// <summary>
/// Draws a clock on a square page.
/// Inspired by Charles Petzold's AnalogClock sample in
/// 'Programming Microsoft Windows with C#'.
/// </summary>
void RenderClock(XGraphics gfx)
{
// Clocks should always look happy on hardcopies...
//this.time = new DateTime(2005, 1, 1, 11, 6, 22, 500);
XColor strokeColor = XColors.DarkBlue;
XColor fillColor = XColors.DarkOrange;
XPen pen = new XPen(strokeColor, 5);
XBrush brush = new XSolidBrush(fillColor);
strokeColor.A = 0.8;
fillColor.A = 0.8;
XPen handPen = new XPen(strokeColor, 5);
XBrush handBrush = new XSolidBrush(fillColor);
DrawText(gfx, pen, brush);
double width = gfx.PageSize.Width;
double height = gfx.PageSize.Height;
gfx.TranslateTransform(width / 2, height / 2);
double scale = Math.Min(width, height);
gfx.ScaleTransform(scale / 2000);
DrawFace(gfx, pen, brush);
DrawHourHand(gfx, handPen, handBrush);
DrawMinuteHand(gfx, handPen, handBrush);
DrawSecondHand(gfx, new XPen(XColors.Red, 7));
}
示例5: BeginBox
/// <summary>
/// Draws a sample box.
/// </summary>
public void BeginBox(XGraphics gfx, int number)
{
//obracene XY
gfx.RotateAtTransform(90.0, new XPoint(height / 4, width / 4));
gfx.TranslateTransform(+62, +63);
//const int dEllipse = 15;
XRect rect = new XRect(0, 0, height /2 -2, width/2 -2);
if (number % 2 == 0)
rect.X += height/2 +2;
rect.Y = ((number - 1) / 2) * (-width/2 - 3);
//rect.Inflate(-10, -10);
//XRect rect2 = rect;
XPen pen = new XPen(XColors.Black, 1);
gfx.DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height);
//rect2.Offset(this.borderWidth, this.borderWidth);
//gfx.DrawRoundedRectangle(new XSolidBrush(this.shadowColor), rect2, new XSize(dEllipse + 8, dEllipse + 8));
//XLinearGradientBrush brush = new XLinearGradientBrush(rect, this.backColor, this.backColor2, XLinearGradientMode.Vertical);
//gfx.DrawRoundedRectangle(this.borderPen, brush, rect, new XSize(dEllipse, dEllipse));
//rect.Inflate(-5, -5);
//rect.Inflate(-10, -5);
//rect.Y += 20;
//rect.Height -= 20;
////gfx.DrawRectangle(XPens.Red, rect);
// gfx.TranslateTransform(rect.X, rect.Y);
this.state = gfx.Save();
}
示例6: DrawLine
/// <summary>
/// Draws simple lines.
/// </summary>
void DrawLine(XGraphics gfx, int number)
{
BeginBox(gfx, number, "DrawLine");
gfx.DrawLine(XPens.DarkGreen, 0, 0, 250, 0);
gfx.DrawLine(XPens.Gold, 15, 7, 230, 15);
XPen pen = new XPen(XColors.Navy, 4);
gfx.DrawLine(pen, 0, 20, 250, 20);
pen = new XPen(XColors.Firebrick, 6);
pen.DashStyle = XDashStyle.Dash;
gfx.DrawLine(pen, 0, 40, 250, 40);
pen.Width = 7.3;
pen.DashStyle = XDashStyle.DashDotDot;
gfx.DrawLine(pen, 0, 60, 250, 60);
pen = new XPen(XColors.Goldenrod, 10);
pen.LineCap = XLineCap.Flat;
gfx.DrawLine(pen, 10, 90, 240, 90);
gfx.DrawLine(XPens.Black, 10, 90, 240, 90);
pen = new XPen(XColors.Goldenrod, 10);
pen.LineCap = XLineCap.Square;
gfx.DrawLine(pen, 10, 110, 240, 110);
gfx.DrawLine(XPens.Black, 10, 110, 240, 110);
pen = new XPen(XColors.Goldenrod, 10);
pen.LineCap = XLineCap.Round;
gfx.DrawLine(pen, 10, 130, 240, 130);
gfx.DrawLine(XPens.Black, 10, 130, 240, 130);
EndBox(gfx);
}
示例7: RenderCurves
/// <summary>
/// Draws curves.
/// </summary>
void RenderCurves(XGraphics gfx)
{
gfx.TranslateTransform(15, 20);
XPoint[] points = { new XPoint(20, 30), new XPoint(60, 120), new XPoint(90, 20), new XPoint(170, 90), new XPoint(230, 40) };
XPen pen = new XPen(XColors.RoyalBlue, 3.5);
gfx.DrawCurve(pen, points, 1);
}
示例8: DrawDebuggingCrosshair
private void DrawDebuggingCrosshair(XGraphics context)
{
var pen = new XPen(XColors.Red);
var w = form.Size.Width;
var h = form.Size.Height;
context.DrawLine(pen, 0, 0, w, h);
context.DrawLine(pen, w, 0, 0, h);
}
示例9: RenderClosedCurves
void RenderClosedCurves(XGraphics gfx)
{
gfx.TranslateTransform(15, 20);
XPen pen = new XPen(XColors.DarkBlue, 2.5);
gfx.DrawClosedCurve(pen, XBrushes.SkyBlue,
new XPoint[] { new XPoint(10, 120), new XPoint(80, 30), new XPoint(220, 20), new XPoint(170, 110), new XPoint(100, 90) },
XFillMode.Winding, 0.7);
}
示例10: MakePen
private static XPen MakePen(bool dotted)
{
var pen = new XPen(XColors.Black);
if (dotted) {
pen.DashStyle = XDashStyle.Dash;
}
return pen;
}
示例11: RenderPolygons
void RenderPolygons(XGraphics gfx)
{
gfx.TranslateTransform(15, 20);
XPen pen = new XPen(XColors.DarkBlue, 2.5);
gfx.DrawPolygon(pen, XBrushes.LightCoral, GeometryObjects.GetPentagram(50, new XPoint(60, 70)), XFillMode.Winding);
gfx.DrawPolygon(pen, XBrushes.LightCoral, GeometryObjects.GetPentagram(50, new XPoint(180, 70)), XFillMode.Alternate);
}
示例12: XPoint
/// <summary>
/// Draws Bézier curves.
/// </summary>
void RenderBéziers(XGraphics gfx)
{
gfx.TranslateTransform(15, 20);
XPoint[] points = {new XPoint(20, 30), new XPoint(40, 120), new XPoint(80, 20), new XPoint(110, 90),
new XPoint(180, 40), new XPoint(210, 40), new XPoint(220, 80)};
XPen pen = new XPen(XColors.Firebrick, 4);
//pen.DashStyle = XDashStyle.Dot;
gfx.DrawBeziers(pen, points);
}
示例13: RenderEllipses
void RenderEllipses(XGraphics gfx)
{
gfx.TranslateTransform(15, 20);
XPen pen = new XPen(XColors.Navy, Math.PI);
gfx.DrawRectangle(pen, 10, 0, 100, 60);
gfx.DrawRectangle(XBrushes.DarkOrange, 130, 0, 100, 60);
gfx.DrawRectangle(pen, XBrushes.DarkOrange, 10, 80, 100, 60);
gfx.DrawRectangle(pen, XBrushes.DarkOrange, 150, 80, 60, 60);
}
示例14: RenderPies
void RenderPies(XGraphics gfx)
{
gfx.TranslateTransform(15, 20);
XPen pen = new XPen(XColors.DarkBlue, 2.5);
gfx.DrawPie(pen, 10, 0, 100, 90, -120, 75);
gfx.DrawPie(XBrushes.Gold, 130, 0, 100, 90, -160, 150);
gfx.DrawPie(pen, XBrushes.Gold, 10, 50, 100, 90, 80, 70);
gfx.DrawPie(pen, XBrushes.Gold, 150, 80, 60, 60, 35, 290);
}
示例15: RenderRoundedRectangles
void RenderRoundedRectangles(XGraphics gfx)
{
gfx.TranslateTransform(15, 20);
XPen pen = new XPen(XColors.RoyalBlue, Math.PI);
gfx.DrawRoundedRectangle(pen, 10, 0, 100, 60, 30, 20);
gfx.DrawRoundedRectangle(XBrushes.Orange, 130, 0, 100, 60, 30, 20);
gfx.DrawRoundedRectangle(pen, XBrushes.Orange, 10, 80, 100, 60, 30, 20);
gfx.DrawRoundedRectangle(pen, XBrushes.Orange, 150, 80, 60, 60, 20, 20);
}