本文整理汇总了C#中Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawEllipse方法的典型用法代码示例。如果您正苦于以下问题:C# CanvasDrawingSession.DrawEllipse方法的具体用法?C# CanvasDrawingSession.DrawEllipse怎么用?C# CanvasDrawingSession.DrawEllipse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Graphics.Canvas.CanvasDrawingSession
的用法示例。
在下文中一共展示了CanvasDrawingSession.DrawEllipse方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawOval
private void DrawOval(CanvasControl sender, CanvasDrawingSession ds)
{
var width = (float) sender.ActualWidth;
var height = (float) sender.ActualHeight;
var center = new Vector2(width / 2, height / 2);
var stroke = this.defaultStroke;
var radiusX = (width / 3) - stroke;
var radiusY = (height / 2) - stroke;
ds.FillEllipse(center ,radiusX,radiusY, ForegroundColor);
ds.DrawEllipse(center, radiusX, radiusY, GlowColor, stroke);
}
示例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;
//.........这里部分代码省略.........
示例3: DrawEllipseInternal
private static void DrawEllipseInternal(
CanvasDrawingSession ds,
Color brush,
Color pen,
CanvasStrokeStyle ss,
bool isStroked,
bool isFilled,
ref Rect2 rect,
double strokeWidth)
{
double radiusX = rect.Width / 2.0;
double radiusY = rect.Height / 2.0;
double x = rect.X + radiusX;
double y = rect.Y + radiusY;
if (isFilled)
{
ds.FillEllipse(
(float)x,
(float)y,
(float)radiusX,
(float)radiusY,
brush);
}
if (isStroked)
{
ds.DrawEllipse(
(float)x,
(float)y,
(float)radiusX,
(float)radiusY,
pen,
(float)strokeWidth,
ss);
}
}
示例4: DrawSimpleSampleIcon
// For SimpleSample, we draw the same simple graphics as the sample itself.
static void DrawSimpleSampleIcon(CanvasDrawingSession ds, IconInfo iconInfo)
{
ds.DrawEllipse(155, 115, 80, 30, Colors.Black, 3);
ds.DrawText("Hello, world!", 100, 100, Colors.Yellow);
}