本文整理汇总了C#中Ellipse类的典型用法代码示例。如果您正苦于以下问题:C# Ellipse类的具体用法?C# Ellipse怎么用?C# Ellipse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Ellipse类属于命名空间,在下文中一共展示了Ellipse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
Console.WriteLine("Введите количество фигур: ");
int n = Convert.ToInt32(Console.ReadLine());
Random rand = new Random();
Ellipse[] ellipse = new Ellipse[n];
for (int i = 0; i < ellipse.Length; i++)
{
ellipse[i] = new Ellipse();
ellipse[i].VerticalRad = rand.Next(1, 100);
ellipse[i].HorisontalRad = rand.Next(1, 100);
Console.WriteLine("Эллипс по номером: {0}", i);
Console.WriteLine("");
ellipse[i].print();
Console.WriteLine("");
}
int minP = 0;
int minS = 0;
for (int i = 1; i < ellipse.Length; i++)
{
if (ellipse[minS].GetSquare() > ellipse[i].GetSquare()) minS = i;
if (ellipse[minP].GetPerimetr() > ellipse[i].GetPerimetr()) minP = i;
}
Console.WriteLine("Минимальный периметр у эллипса №{0} с параметрами: а = {1}, b = {2}", minP, ellipse[minP].HorisontalRad, ellipse[minP].VerticalRad);
Console.WriteLine("Минимальная площадь у эллипса №{0} с параметрами: а = {1}, b = {2}", minS, ellipse[minS].HorisontalRad, ellipse[minS].VerticalRad);
Console.ReadKey();
}
示例2: RenderingHiddenEllipseDoesNotThrowException
public void RenderingHiddenEllipseDoesNotThrowException()
{
var ellipse = new Ellipse(Vector2D.Half, 0.4f, 0.2f, Color.Red);
ellipse.Add(new OutlineColor(Color.Yellow));
ellipse.OnDraw<DrawPolygon2DOutlines>();
Assert.DoesNotThrow(() => AdvanceTimeAndUpdateEntities());
}
示例3: RenderedGeometry
public void RenderedGeometry ()
{
Ellipse e = new Ellipse ();
Geometry g = e.RenderedGeometry;
StreamGeometry stream_geometry = (StreamGeometry)g;
Assert.AreEqual (stream_geometry.ToString (), "");
}
示例4: EllipseRenderUnit
/// <summary>
/// Initializes a new instance of the <see cref="EllipseRenderUnit" /> class.
/// </summary>
/// <param name="ellipse">The ellipse.</param>
/// <param name="stroke">The stroke.</param>
/// <param name="fill">The fill.</param>
/// <param name="thickness">The thickness.</param>
public EllipseRenderUnit(Ellipse ellipse, Brush stroke, Brush fill, float thickness)
{
this.ellipse = ellipse;
this.bounds = new RectangleF(ellipse.Point.X - ellipse.RadiusX, ellipse.Point.Y - ellipse.RadiusY, ellipse.RadiusX * 2, ellipse.RadiusY * 2);
this.stroke = stroke;
this.fill = fill;
this.thickness = thickness;
}
示例5: EllipseShape
internal EllipseShape(Paint2DForm parent, Ellipse ellipse, float strokeWidth, int selectedBrush, bool fill)
: base(parent, fill)
{
_startPoint = ellipse.Point;
_ellipse = ellipse;
_strokeWidth = strokeWidth;
_selectedBrushIndex = selectedBrush;
}
示例6: CreateEllipse
public static Ellipse CreateEllipse(double x, double y, double w, double h)
{
double x2 = x + w;
double y2 = y + h;
var ellipse = new Ellipse
{ Margin = new Thickness(x, y, x2, y2), Width = Math.Abs(x2 - x), Height = Math.Abs(y2 - y) };
return ellipse;
}
示例7: RenderingPolygonWithNoPointsDoesNotError
public void RenderingPolygonWithNoPointsDoesNotError()
{
var ellipse = new Ellipse(Vector2D.Half, 0.4f, 0.2f, Color.Blue);
var points = ellipse.Get<List<Vector2D>>();
points.Clear();
ellipse.Remove<Ellipse.UpdatePointsIfRadiusChanges>();
ellipse.Add(new OutlineColor(Color.Red));
ellipse.OnDraw<DrawPolygon2DOutlines>();
}
示例8: EllipseRectangleTest
/// <summary>
/// Determines if an ellipse and a rectangle intersect.
/// </summary>
/// <param name="ellipse">The ellipse.</param>
/// <param name="rectangle">The rectangle.</param>
/// <returns></returns>
public static bool EllipseRectangleTest(Ellipse ellipse, OrthoRectangle rectangle)
{
bool testXpos = (ellipse.Center.X + ellipse.RadiusX) > rectangle.Right;
bool testXneg = (ellipse.Center.X - ellipse.RadiusX) < rectangle.Left;
bool testYpos = (ellipse.Center.Y + ellipse.RadiusY) > rectangle.Top;
bool testYneg = (ellipse.Center.Y - ellipse.RadiusY) < rectangle.Bottom;
return testXpos || testXneg || testYpos || testYneg;
}
示例9: RadiusIsAlwaysTheMaximumValue
public void RadiusIsAlwaysTheMaximumValue()
{
const float BigValue = 0.4f;
const float SmallValue = 0.2f;
var ellipseWidth = new Ellipse(Vector2D.Half, BigValue, SmallValue, Color.Red);
var ellipseHeight = new Ellipse(Vector2D.Half, SmallValue, BigValue, Color.Red);
Assert.AreEqual(BigValue, ellipseWidth.Radius);
Assert.AreEqual(BigValue, ellipseHeight.Radius);
}
示例10: add
private void add(Grid grid, int row, int column)
{
Ellipse dot = new Ellipse();
dot.Width = 20;
dot.Height = 20;
dot.Fill = new SolidColorBrush(Colors.White);
dot.SetValue(Grid.ColumnProperty, column);
dot.SetValue(Grid.RowProperty, row);
grid.Children.Add(dot);
}
示例11: CoordinateTrans
/// <summary>
/// 构造函数
/// </summary>
/// <param name="elp">椭球类型</param>
/// <param name="a">椭球参数a(如果为自定义的椭球)</param>
/// <param name="b">椭球参数b(如果为自定义的椭球)</param>
public CoordinateTrans(Ellipse elp,double a=0,double b=0)
{
ep = new Ellipsoid();
switch (elp)
{
case Ellipse.International1975: ep.International_ellipsoid1975(); break;
case Ellipse.WGS84: ep.WGS84_ellipsoid(); break;
case Ellipse.CGCS2000: ep.CGCS2000_ellipsoid(); break;
case Ellipse.Other: ep = new Ellipsoid(a, b); break;
}
}
示例12: ManuallySetTheRadius
public void ManuallySetTheRadius()
{
const float OriginalRadius = 0.2f;
const float NewRadius = 0.4f;
var ellipse = new Ellipse(Vector2D.Half, OriginalRadius, OriginalRadius, Color.Red);
Assert.AreEqual(OriginalRadius, ellipse.RadiusX);
Assert.AreEqual(OriginalRadius, ellipse.RadiusY);
ellipse.Radius = NewRadius;
Assert.AreEqual(NewRadius, ellipse.RadiusX);
Assert.AreEqual(NewRadius, ellipse.RadiusY);
}
示例13: RenderingWithEntityHandlersInAnyOrder
public void RenderingWithEntityHandlersInAnyOrder()
{
var ellipse1 = new Ellipse(Vector2D.Half, 0.4f, 0.2f, Color.Blue) { RenderLayer = 0 };
ellipse1.Add(new OutlineColor(Color.Red));
ellipse1.OnDraw<DrawPolygon2D>();
ellipse1.OnDraw<DrawPolygon2DOutlines>();
var ellipse2 = new Ellipse(Vector2D.Half, 0.1f, 0.2f, Color.Green) { RenderLayer = 1 };
ellipse2.Add(new OutlineColor(Color.Red));
ellipse2.OnDraw<DrawPolygon2DOutlines>();
ellipse2.OnDraw<DrawPolygon2D>();
}
示例14: Clone
/// <summary>
/// Clones this instance.
/// </summary>
/// <returns>
/// The same shape
/// </returns>
/// <exception cref="System.NotImplementedException"></exception>
public override ShapeBase Clone()
{
var shape = new Ellipse
{
Location = Location,
Size = Size,
DrawMethod = DrawMethod,
OutlineColor = OutlineColor,
OutlineWidth = OutlineWidth,
FillColor = FillColor
};
return shape;
}
示例15: EllipseShape
public EllipseShape(RenderTarget initialRenderTarget, Random random, D2DFactory d2DFactory, D2DBitmap bitmap)
: base(initialRenderTarget, random, d2DFactory, bitmap)
{
ellipse = RandomEllipse();
double which = Random.NextDouble();
if (which < 0.67)
PenBrush = RandomBrush();
if (which > 0.33)
FillBrush = RandomBrush();
if (CoinFlip)
StrokeStyle = RandomStrokeStyle();
StrokeWidth = RandomStrokeWidth();
}