33 lines
846 B
C#
33 lines
846 B
C#
using System.Windows;
|
|
using System.Windows.Media;
|
|
|
|
namespace DrawFigureLibrary.Figures
|
|
{
|
|
public class EllipseFigure : Figure
|
|
{
|
|
public EllipseFigure(string name, int x, int y, int w, int h) : base(name, x, y, w, h) { }
|
|
|
|
public override void Draw(DrawingContext drawingContext)
|
|
{
|
|
double cx = x + w / 2.0;
|
|
double cy = y + h / 2.0;
|
|
|
|
double rx = w / 2.0;
|
|
double ry = h / 2.0;
|
|
|
|
drawingContext.DrawEllipse(null, Init.pen, new Point(cx, cy), rx, ry);
|
|
}
|
|
|
|
public override void MoveBy(int deltaX, int deltaY)
|
|
{
|
|
if (Init.DrawingImage == null) return;
|
|
|
|
if (Figure.Check(this, deltaX, deltaY, Init.DrawingImage))
|
|
{
|
|
x += deltaX;
|
|
y += deltaY;
|
|
}
|
|
}
|
|
}
|
|
}
|