本文整理汇总了C#中Xwt.Stroke方法的典型用法代码示例。如果您正苦于以下问题:C# Xwt.Stroke方法的具体用法?C# Xwt.Stroke怎么用?C# Xwt.Stroke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xwt
的用法示例。
在下文中一共展示了Xwt.Stroke方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnDraw
protected override void OnDraw(Xwt.Drawing.Context ctx, Xwt.Rectangle dirtyRect)
{
base.OnDraw(ctx, dirtyRect);
if (pages == null)
{
return;
}
ctx.Font = this.Font;
ctx.Save();
int width = (int)(report.PageWidthPoints * Scale);
int height = (int)(report.PageHeightPoints * Scale);
//Xwt.Rectangle rep_r = new Xwt.Rectangle(1, 1, width - 1, height - 1);
//RenderXwt render = new RenderXwt(ctx, Scale);
//render.RunPage(pages);
//ctx.Stroke();
// Page Drawing using System.Drawing converted to Xwt Context
PageDrawing render = new PageDrawing(ctx, 1f);
render.RunPage(pages);
ctx.Stroke();
ctx.Save();
}
示例2: OnDraw
protected override void OnDraw(Xwt.Drawing.Context ctx, Xwt.Rectangle dirtyRect)
{
base.OnDraw(ctx, dirtyRect);
if (pages == null)
{
return;
}
ctx.Save();
//Xwt.Rectangle rep_r = new Xwt.Rectangle(1, 1, width - 1, height - 1);
//RenderXwt render = new RenderXwt(ctx, Scale);
//render.RunPage(pages);
//ctx.Stroke();
if (_defaultBackend == Backend.PureXwt)
{
RenderXwt render = new RenderXwt(ctx, this, 1f);
render.RunPage(pages);
}
else
{
// Page Drawing using System.Drawing converted to Xwt Context
PageDrawing render = new PageDrawing(ctx, 1f, Convert.ToInt32(this.MinWidth), Convert.ToInt32(this.MinHeight));
render.RunPage(pages);
}
ctx.Stroke();
ctx.Save();
}
示例3: OnDraw
protected override void OnDraw(Xwt.Drawing.Context ctx, Rectangle dirtyRect)
{
base.OnDraw(ctx, dirtyRect);
//ctx.SetColor(PluginType.GetColor());
ctx.SetLineDash(0, 4d, 4d);
ctx.Rectangle(0, 0, PluginWidget.Size.Width, PluginWidget.Size.Height);
ctx.Stroke();
}
示例4: OnDraw
protected override void OnDraw(Xwt.Drawing.Context ctx, Rectangle dirtyRect)
{
base.OnDraw(ctx, dirtyRect);
ctx.SetColor(Colors.DarkGray);
ctx.SetLineWidth(1);
ctx.MoveTo(0, 0);
ctx.LineTo(0, Bounds.Height);
ctx.Stroke();
}
示例5: Rotate
public virtual void Rotate(Xwt.Drawing.Context ctx, double x, double y)
{
ctx.Save ();
ctx.Translate (x + 30, y + 30);
ctx.SetLineWidth (3);
// Rotation
double end = 270;
double r = 30;
for (double n = 0; n<=end; n += 5) {
ctx.Save ();
ctx.Rotate (n);
ctx.MoveTo (0, 0);
ctx.RelLineTo (r, 0);
double c = n / end;
ctx.SetColor (new Color (c, c, c));
ctx.Stroke ();
// Visual test for TransformPoints
Point p0 = new Point (0,0);
Point p1 = new Point (0, -r);
Point[] p = new Point[] {p0, p1};
ctx.TransformPoints (p);
ctx.ResetTransform ();
ctx.Translate (2 * r + 1, 0);
ctx.MoveTo (p[0]);
ctx.LineTo (p[1]);
c = 1-c;
ctx.SetColor (new Color (c, c, c));
ctx.Stroke();
ctx.Restore ();
}
ctx.Restore ();
}
示例6: OnDraw
protected override void OnDraw(Xwt.Drawing.Context ctx, Rectangle dirtyRect)
{
base.OnDraw(ctx, dirtyRect);
if (HasBorder)
{
ctx.SetColor(PluginType.GetColor());
ctx.SetLineWidth(1);
if (HasBorderLineDash)
ctx.SetLineDash(0, 4d, 4d);
ctx.Rectangle(0, 0, WidthRequest, HeightRequest);
ctx.Stroke();
}
}
示例7: OnDraw
protected override void OnDraw(Xwt.Drawing.Context ctx)
{
base.OnDraw (ctx);
ctx.Translate (30, 30);
double end = 270;
for (double n = 0; n<=end; n += 5) {
ctx.Save ();
ctx.Rotate (n);
ctx.MoveTo (0, 0);
ctx.RelLineTo (30, 0);
double c = n / end;
ctx.SetColor (new Color (c, c, c));
ctx.Stroke ();
ctx.Restore ();
}
}
示例8: Rotate
public virtual void Rotate(Xwt.Drawing.Context ctx, double x, double y)
{
// draws a line along the x-axis from (0,0) to (r,0) with a constant translation and an increasing
// rotational component. This composite transform is then applied to a vertical line, with inverse
// color, and an additional x-offset, to form a mirror image figure for easy visual comparison.
// These transformed points must be drawn with the identity CTM, hence the Restore() each time.
ctx.Save (); // save caller's context (assumed to be the Identity CTM)
ctx.SetLineWidth (3); // should align exactly if drawn with half-pixel coordinates
// Vector length (pixels) and rotation limit (degrees)
double r = 30;
double end = 270;
for (double n = 0; n<=end; n += 5) {
ctx.Save (); // save context and identity CTM for each line
// Set up translation to centre point of first figure, ensuring pixel alignment
ctx.Translate (x + 30.5, y + 30.5);
ctx.Rotate (n);
ctx.MoveTo (0, 0);
ctx.RelLineTo (r, 0);
double c = n / end;
ctx.SetColor (new Color (c, c, c));
ctx.Stroke (); // stroke first figure with composite Translation and Rotation CTM
// Generate mirror image figure as a visual test of TransformPoints
Point p0 = new Point (0,0);
Point p1 = new Point (0, -r);
Point[] p = new Point[] {p0, p1};
ctx.TransformPoints (p); // using composite transformation
ctx.Restore (); // restore identity CTM
ctx.Save (); // save again (to restore after additional Translation)
ctx.Translate (2 * r + 1, 0); // extra x-offset to clear first figure
ctx.MoveTo (p[0]);
ctx.LineTo (p[1]);
c = 1-c;
ctx.SetColor (new Color (c, c, c));
ctx.Stroke(); // stroke transformed points with offset in CTM
ctx.Restore (); // restore identity CTM for next line
}
ctx.Restore (); // restore caller's context
}
示例9: OnDraw
protected override void OnDraw(Xwt.Drawing.Context ctx)
{
base.OnDraw (ctx);
ctx.SetLineDash (15, 10, 10, 5, 5);
ctx.Rectangle (100, 100, 100, 100);
ctx.Stroke ();
ctx.SetLineDash (0);
ImageBuilder ib = new ImageBuilder (30, 30, ImageFormat.ARGB32);
ib.Context.Arc (15, 15, 15, 0, 360);
ib.Context.SetColor (new Color (1, 0, 1));
ib.Context.Rectangle (0, 0, 5, 5);
ib.Context.Fill ();
var img = ib.ToImage ();
ctx.DrawImage (img, 90, 90);
ctx.DrawImage (img, 90, 140, 50, 10);
ctx.Arc (190, 190, 15, 0, 360);
ctx.SetColor (new Color (1, 0, 1, 0.4));
ctx.Fill ();
ctx.Save ();
ctx.Translate (90, 220);
ctx.Pattern = new ImagePattern (img);
ctx.Rectangle (0, 0, 100, 70);
ctx.Fill ();
ctx.Restore ();
ctx.Translate (30, 30);
double end = 270;
for (double n = 0; n<=end; n += 5) {
ctx.Save ();
ctx.Rotate (n);
ctx.MoveTo (0, 0);
ctx.RelLineTo (30, 0);
double c = n / end;
ctx.SetColor (new Color (c, c, c));
ctx.Stroke ();
ctx.Restore ();
}
}
示例10: Texts
public virtual void Texts(Xwt.Drawing.Context ctx, double x, double y)
{
ctx.Save ();
ctx.Translate (x, y);
ctx.SetColor (Colors.Black);
var col1 = new Rectangle ();
var col2 = new Rectangle ();
var text = new TextLayout ();
text.Font = this.Font.WithSize (24);
Console.WriteLine (text.Font.Size);
// first text
text.Text = "Lorem ipsum dolor sit amet,";
var size1 = text.GetSize ();
col1.Width = size1.Width;
col1.Height += size1.Height + 10;
ctx.DrawTextLayout (text, 0, 0);
// proofing width; test should align with text above
ctx.SetColor (Colors.DarkMagenta);
text.Text = "consetetur sadipscing elitr, sed diam nonumy";
text.Width = col1.Width;
var size2 = text.GetSize ();
ctx.DrawTextLayout (text, 0, col1.Bottom);
col1.Height += size2.Height + 10;
ctx.SetColor (Colors.Black);
// proofing scale, on second col
ctx.Save ();
ctx.SetColor (Colors.Red);
col2.Left = col1.Right + 10;
text.Text = "eirmod tempor invidunt ut.";
var scale = 1.2;
text.Width = text.Width / scale;
var size3 = text.GetSize ();
col2.Height = size3.Height * scale;
col2.Width = size3.Width * scale + 5;
ctx.Scale (scale, scale);
ctx.DrawTextLayout (text, col2.Left / scale, col2.Top / scale);
ctx.Restore ();
// proofing heigth, on second col
ctx.Save ();
ctx.SetColor (Colors.DarkCyan);
text.Text = "Praesent ac lacus nec dolor pulvinar feugiat a id elit.";
var size4 = text.GetSize ();
text.Height = size4.Height / 2;
text.Trimming=TextTrimming.WordElipsis;
ctx.DrawTextLayout (text, col2.Left, col2.Bottom + 5);
ctx.SetLineWidth (1);
ctx.SetColor (Colors.Blue);
ctx.Rectangle (new Rectangle (col2.Left, col2.Bottom + 5, text.Width, text.Height));
ctx.Stroke();
ctx.Restore ();
// drawing col line
ctx.SetLineWidth (1);
ctx.SetColor (Colors.Black.WithAlpha (.5));
ctx.MoveTo (col1.Right + 5, col1.Top);
ctx.LineTo (col1.Right + 5, col1.Bottom);
ctx.Stroke ();
ctx.MoveTo (col2.Right + 5, col2.Top);
ctx.LineTo (col2.Right + 5, col2.Bottom);
ctx.Stroke ();
ctx.SetColor (Colors.Black);
// proofing rotate, and printing size to see the values
ctx.Save ();
text.Font = this.Font.WithSize (10);
text.Text = string.Format ("Size 1 {0}\r\nSize 2 {1}\r\nSize 3 {2} Scale {3}",
size1, size2, size3, scale);
text.Width = -1; // this clears textsize
text.Height = -1;
ctx.Rotate (5);
// maybe someone knows a formula with angle and textsize to calculyte ty
var ty = 30;
ctx.DrawTextLayout (text, ty, col1.Bottom + 10);
ctx.Restore ();
// scale example here:
ctx.Restore ();
TextLayout tl0 = new TextLayout (this);
tl0.Font = this.Font.WithSize (10);
tl0.Text = "This text contains attributes.";
tl0.SetUnderline ( 0, "This".Length);
//.........这里部分代码省略.........
示例11: OnDraw
protected override void OnDraw (Xwt.Drawing.Context ctx, Rectangle dirtyRect)
{
if (Bounds.IsEmpty)
return;
ctx.Rectangle (0, 0, Bounds.Width, Bounds.Height);
Gradient g = null;
if (Linear)
g = new LinearGradient (xStart, 0, xEnd, Bounds.Height);
else
g = new RadialGradient (Bounds.Width / 2, Bounds.Height / 2, Bounds.Width / 2, Bounds.Width / 2, Bounds.Height / 2, xStart/4 + Bounds.Width / 8);
g.AddColorStop (0, stop1);
g.AddColorStop (1, stop2);
ctx.Pattern = g;
ctx.Fill ();
Rectangle r = rect.Inflate (5, 5);
ctx.Rectangle (r);
ctx.SetColor (new Color (0,0,1));
ctx.SetLineWidth (1);
ctx.Stroke ();
}
示例12: OnDraw
protected override void OnDraw(Xwt.Drawing.Context ctx, Rectangle dirtyRect)
{
ctx.Rectangle (0, 0, Bounds.Width, Bounds.Height);
var g = new LinearGradient (0, 0, Bounds.Width, Bounds.Height);
g.AddColorStop (0, new Color (1, 0, 0));
g.AddColorStop (1, new Color (0, 1, 0));
ctx.Pattern = g;
ctx.Fill ();
Rectangle r = rect.Inflate (5, 5);
ctx.Rectangle (r);
ctx.SetColor (new Color (0,0,1));
ctx.SetLineWidth (1);
ctx.Stroke ();
}
示例13: OnDraw
protected override void OnDraw(Xwt.Drawing.Context ctx, Rectangle dirtyRect)
{
//bg
ctx.SetColor(installed ? BgColorInstalled : BgColorUninstalled);
//ctx.SetColor(Colors.White);
ctx.Rectangle(dirtyRect);
ctx.Fill();
//border
ctx.SetColor(installed ? BorderColorInstalled : BorderColorUninstalled);
ctx.SetLineWidth(1);
ctx.Rectangle(0, 0, WidthRequest, HeightRequest);
ctx.Stroke();
}
示例14: DrawGradientButton
void DrawGradientButton(Xwt.Drawing.Context G, GradientButton B)
{
DrawingPath P = new DrawingPath();
P.Rectangle(new Xwt.Rectangle(B.Position, B.Size));
LinearGradient gr;
G.AppendPath(P);
Pattern pat = gr = new LinearGradient(B.Position.X, B.Position.Y, B.Position.X + B.Size.Width, B.Position.Y + B.Size.Height);
gr.AddColorStop(0, B.Color.BlendWith(Colors.White, 0.8));
gr.AddColorStop(0.5, B.Color);
gr.AddColorStop(1, B.Color.BlendWith(Colors.White, 0.8));
G.Pattern = pat;
G.Fill();
G.AppendPath(P);
G.SetColor(Xwt.Drawing.Colors.Black);
G.SetLineWidth(1);
G.Stroke();
TextLayout L = new TextLayout()
{
Font = B.Font,
Text = B.Text
};
Size TextSize = new Size(0.6 * L.Font.Size * L.Text.Count(), L.Font.Size);
G.DrawTextLayout(L, new Xwt.Point(B.Position.X + B.Size.Width / 2 - TextSize.Width / 2, B.Position.Y + B.Size.Height / 2 - TextSize.Height / 2));
}
示例15: OnDraw
protected override void OnDraw(Xwt.Drawing.Context ctx)
{
base.OnDraw (ctx);
// Simple rectangles
ctx.SetLineWidth (1);
ctx.Rectangle (100, 5, 10, 10);
ctx.SetColor (Color.Black);
ctx.Fill ();
ctx.Rectangle (115, 5, 10, 10);
ctx.SetColor (Color.Black);
ctx.Stroke ();
//
ctx.SetLineWidth (3);
ctx.Rectangle (100, 20, 10, 10);
ctx.SetColor (Color.Black);
ctx.Fill ();
ctx.Rectangle (115, 20, 10, 10);
ctx.SetColor (Color.Black);
ctx.Stroke ();
// Rectangle with hole
ctx.Rectangle (10, 100, 40, 40);
ctx.MoveTo (45, 135);
ctx.RelLineTo (0, -20);
ctx.RelLineTo (-20, 0);
ctx.RelLineTo (0, 20);
ctx.ClosePath ();
ctx.SetColor (Color.Black);
ctx.Fill ();
// Dashed lines
ctx.SetLineDash (15, 10, 10, 5, 5);
ctx.Rectangle (100, 100, 100, 100);
ctx.Stroke ();
ctx.SetLineDash (0);
ImageBuilder ib = new ImageBuilder (30, 30, ImageFormat.ARGB32);
ib.Context.Arc (15, 15, 15, 0, 360);
ib.Context.SetColor (new Color (1, 0, 1));
ib.Context.Rectangle (0, 0, 5, 5);
ib.Context.Fill ();
var img = ib.ToImage ();
ctx.DrawImage (img, 90, 90);
ctx.DrawImage (img, 90, 140, 50, 10);
ctx.Arc (190, 190, 15, 0, 360);
ctx.SetColor (new Color (1, 0, 1, 0.4));
ctx.Fill ();
ctx.Save ();
ctx.Translate (90, 220);
ctx.Pattern = new ImagePattern (img);
ctx.Rectangle (0, 0, 100, 70);
ctx.Fill ();
ctx.Restore ();
ctx.Translate (30, 30);
double end = 270;
for (double n = 0; n<=end; n += 5) {
ctx.Save ();
ctx.Rotate (n);
ctx.MoveTo (0, 0);
ctx.RelLineTo (30, 0);
double c = n / end;
ctx.SetColor (new Color (c, c, c));
ctx.Stroke ();
ctx.Restore ();
}
ctx.ResetTransform ();
}