本文整理汇总了C#中Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawRoundedRectangle方法的典型用法代码示例。如果您正苦于以下问题:C# CanvasDrawingSession.DrawRoundedRectangle方法的具体用法?C# CanvasDrawingSession.DrawRoundedRectangle怎么用?C# CanvasDrawingSession.DrawRoundedRectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Graphics.Canvas.CanvasDrawingSession
的用法示例。
在下文中一共展示了CanvasDrawingSession.DrawRoundedRectangle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawRoundedRectangle
private void DrawRoundedRectangle(CanvasControl sender, CanvasDrawingSession ds)
{
var width = (float)sender.ActualWidth;
var height = (float)sender.ActualHeight;
int steps = Math.Min((int)(width / 30), 10);
for (int i = 0; i < steps; ++i)
{
var mu = (float)i / steps;
var color = GradientColor(mu);
mu *= 0.5f;
var x = mu * width;
var y = mu * height;
var xx = (1 - mu) * width;
var yy = (1 - mu) * height;
var radius = mu * 50.0f;
ds.DrawRoundedRectangle(
x, y,
xx-x, yy-y,
radius, radius,
color,
2.0f);
}
}
示例2: DrawStuff
void DrawStuff(CanvasDrawingSession ds)
{
int horizontalLimit = (int)m_canvasControl.ActualWidth;
int verticalLimit = (int)m_canvasControl.ActualHeight;
const float thickStrokeWidth = 80.0f;
DrawnContentType drawnContentType = (DrawnContentType)m_drawnContentTypeCombo.SelectedValue;
ds.Clear(NextRandomColor());
Rect rect;
Vector2 point;
float radiusX;
float radiusY;
switch (drawnContentType)
{
case DrawnContentType.Clear_Only:
break;
case DrawnContentType.Bitmap:
if (m_bitmap_tiger != null)
{
ds.DrawImage(m_bitmap_tiger, NextRandomPoint(horizontalLimit, verticalLimit).ToVector2());
}
else
{
DrawNoBitmapErrorMessage(ds, horizontalLimit / 2, verticalLimit / 2);
}
break;
case DrawnContentType.Effect_Blur:
if (m_bitmap_tiger != null)
{
GaussianBlurEffect blurEffect = new GaussianBlurEffect();
blurEffect.StandardDeviation = 2.0f;
blurEffect.Source = m_bitmap_tiger;
ds.DrawImage(blurEffect, NextRandomPoint(horizontalLimit, verticalLimit).ToVector2());
}
else
{
DrawNoBitmapErrorMessage(ds, horizontalLimit / 2, verticalLimit / 2);
}
break;
case DrawnContentType.Line_Thin:
ds.DrawLine(
NextRandomPoint(horizontalLimit, verticalLimit).ToVector2(),
NextRandomPoint(horizontalLimit, verticalLimit).ToVector2(),
NextRandomColor());
break;
case DrawnContentType.Line_Thick:
ds.DrawLine(
NextRandomPoint(horizontalLimit, verticalLimit).ToVector2(),
NextRandomPoint(horizontalLimit, verticalLimit).ToVector2(),
NextRandomColor(),
thickStrokeWidth);
break;
case DrawnContentType.Rectangle_Thin:
ds.DrawRectangle(
NextRandomRect(horizontalLimit, verticalLimit),
NextRandomColor());
break;
case DrawnContentType.Rectangle_Thick:
ds.DrawRectangle(
NextRandomRect(horizontalLimit, verticalLimit),
NextRandomColor(),
thickStrokeWidth);
break;
case DrawnContentType.Rectangle_Filled:
ds.FillRectangle(
NextRandomRect(horizontalLimit, verticalLimit),
NextRandomColor());
break;
case DrawnContentType.RoundedRectangle_Thin:
NextRandomRoundedRect(horizontalLimit, verticalLimit, out rect, out radiusX, out radiusY);
ds.DrawRoundedRectangle(
rect, radiusX, radiusY,
NextRandomColor());
break;
case DrawnContentType.RoundedRectangle_Thick:
NextRandomRoundedRect(horizontalLimit, verticalLimit, out rect, out radiusX, out radiusY);
ds.DrawRoundedRectangle(
rect, radiusX, radiusY,
NextRandomColor(),
thickStrokeWidth);
break;
case DrawnContentType.Ellipse_Thin:
NextRandomEllipse(horizontalLimit, verticalLimit, out point, out radiusX, out radiusY);
ds.DrawEllipse(
point, radiusX, radiusY,
NextRandomColor());
break;
//.........这里部分代码省略.........