本文整理汇总了C#中ICanvas.DrawRectangle方法的典型用法代码示例。如果您正苦于以下问题:C# ICanvas.DrawRectangle方法的具体用法?C# ICanvas.DrawRectangle怎么用?C# ICanvas.DrawRectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICanvas
的用法示例。
在下文中一共展示了ICanvas.DrawRectangle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawTextBox
void DrawTextBox (ICanvas c, string text, Point point, Font f)
{
var b = new SolidBrush (Colors.Black);
var bp = new Pen (Colors.Blue);
var rp = new Pen (Colors.Red);
var size = c.MeasureText (text, f);
c.DrawRectangle (new Rect (point, size.Size) + new Size (0, -size.Ascent), bp);
c.DrawLine (point, point + new Size (size.Width, 0), rp);
c.DrawText (text, point, f, b);
}
示例2: DrawElement
protected override void DrawElement(ICanvas canvas)
{
canvas.DrawRectangle(frame, Pen, Brush);
}
示例3: Draw
public override void Draw(ICanvas canvas, Rect rect)
{
// base.Draw(canvas, rect);
canvas.DrawLine(rect.Left, rect.Top, rect.Width, rect.Top, _custLineColour, 3);
canvas.DrawLine(rect.Left, rect.Height, rect.Width, rect.Height, _custLineColour, 3);
var font = new Font {Size = 20};
var pen = new Pen(Colors.Blue, width: 10);
var brush = new SolidBrush(Colors.White);
canvas.DrawRectangle(new Point(20, 20), new Size(20), pen, brush);
//canvas.DrawText("B", rect, font, TextAlignment.Center, pen);
}
示例4: DrawElement
/// <summary>
/// Draws the element.
/// </summary>
/// <param name="canvas">Canvas.</param>
protected override void DrawElement(ICanvas canvas)
{
canvas.DrawRectangle(frame, Pen?.Clone(), Brush?.Clone());
}