本文整理汇总了C#中Canvas.DrawRectangle方法的典型用法代码示例。如果您正苦于以下问题:C# Canvas.DrawRectangle方法的具体用法?C# Canvas.DrawRectangle怎么用?C# Canvas.DrawRectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Canvas
的用法示例。
在下文中一共展示了Canvas.DrawRectangle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawCrossHair
private static void DrawCrossHair(Canvas canvas)
{
var color = new Color(1, 1, 1);
var x = canvas.Width * 0.5f;
var y = canvas.Height * 0.5f;
var l = 4;
var w = 0.7f;
canvas.DrawRectangle(color, x - w, y - l, x + w, y + l);
canvas.DrawRectangle(color, x - l, y - w, x + l, y + w);
}
示例2: MessageBoxManager
/// <summary>
/// Creates a new MessageBoxManager.
/// </summary>
public MessageBoxManager()
{
_msgBox = new MessageBox("msgBox", 255, 0, 0, (int)(Glide.LCD.Width * 0.80), 0);
_canvas = new Canvas();
_canvas.DrawRectangle(0, 0, 0, 0, Glide.LCD.Width, Glide.LCD.Height, 0, 0, Colors.DarkGray, 0, 0, 0, 0, 0, 125);
_result = ModalResult.None;
}
示例3: RenderBackground
protected override void RenderBackground(Canvas canvas)
{
canvas.DrawRectangle(new Color(0f, 0f, 0f, _backgroundOpacity.Value), 0, 0, canvas.Width, canvas.Height);
}
示例4: RenderBackground
protected override void RenderBackground(Canvas canvas)
{
var left = Left?.Value ?? 0;
var top = Top?.Value ?? 0;
var color = IsHovered ? (IsPressed ? new Color(0.0f, 0.2f, 0.5f, 0.75f) : new Color(0.3f, 0.6f, 1.0f, 0.75f)) : new Color(0.1f, 0.4f, 0.7f, 0.75f);
canvas.DrawRectangle(new Color(0.1f, 0.1f, 0.1f, 0.5f), left, top, left + Width, top + Height);
canvas.DrawRectangle(color, left, top, left + Width, top + Height);
}