本文整理汇总了C#中Ellipse类的典型用法代码示例。如果您正苦于以下问题:C# Ellipse类的具体用法?C# Ellipse怎么用?C# Ellipse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Ellipse类属于命名空间,在下文中一共展示了Ellipse类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:Pin131GasanowO,项目名称:131_RPP_GasanowO,代码行数:29,代码来源:Program.cs
示例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());
}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:EllipseTests.cs
示例3: RenderedGeometry
public void RenderedGeometry ()
{
Ellipse e = new Ellipse ();
Geometry g = e.RenderedGeometry;
StreamGeometry stream_geometry = (StreamGeometry)g;
Assert.AreEqual (stream_geometry.ToString (), "");
}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:7,代码来源:EllipseTest.cs
示例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;
}
开发者ID:huoxudong125,项目名称:oxyplot,代码行数:15,代码来源:EllipseRenderUnit.cs
示例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;
}
开发者ID:Prashant-Jonny,项目名称:phever,代码行数:8,代码来源:EllipseShape.cs
示例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;
}
开发者ID:toSilence,项目名称:System.Drawing.Wrappers,代码行数:8,代码来源:Shapes.Metro.cs
示例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>();
}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:9,代码来源:Polygon2DTests.cs
示例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;
}
开发者ID:yong-ja,项目名称:starodyssey,代码行数:15,代码来源:Intersection.cs
示例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);
}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:9,代码来源:EllipseTests.cs
示例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);
}
开发者ID:vvzwvv,项目名称:UWPTutorials,代码行数:10,代码来源:Library.cs
示例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;
}
}
开发者ID:yihaizhong,项目名称:YTsUtility,代码行数:17,代码来源:CoordinateTrans.cs
示例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);
}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:11,代码来源:EllipseTests.cs
示例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>();
}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:11,代码来源:EllipseTests.cs
示例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;
}
开发者ID:panoti,项目名称:DADHMT_LTW,代码行数:20,代码来源:Ellipse.cs
示例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();
}
开发者ID:Corillian,项目名称:Windows-API-Code-Pack-1.1,代码行数:13,代码来源:EllipseShape.cs
示例16: RecordButton
public RecordButton()
{
var s = new Ellipse()
{
VerticalAlignment = System.Windows.VerticalAlignment.Center,
HorizontalAlignment = System.Windows.HorizontalAlignment.Center,
Width = 12,
Height = 12,
Fill = Brushes.Red,
};
this.ShapeContainerGrid.Children.Add(s);
}
开发者ID:hortonal,项目名称:MrKeys,代码行数:13,代码来源:MediaControlButtons.cs
示例17: RenderedGeometryInWindow
public void RenderedGeometryInWindow ()
{
Window w = new Window ();
Ellipse e = new Ellipse ();
e.Width = 100;
e.Height = 100;
w.Content = e;
w.Show ();
Geometry g = e.RenderedGeometry;
EllipseGeometry ellipse_geometry = (EllipseGeometry)g;
Assert.AreEqual (ellipse_geometry.Bounds.Width, 100, "1");
DrawingGroup drawing_group = VisualTreeHelper.GetDrawing (e);
Assert.IsNull (drawing_group, "2");
}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:14,代码来源:EllipseTest.cs
示例18: Draw
public override void Draw(UIElementCollection collection)
{
Ellipse ellipse;
if (DrawedElement == null)
ellipse = new Ellipse();
else ellipse = (Ellipse)DrawedElement;
UpdateProperties(ellipse);
LocateShapeOnCanvas(ellipse);
if (DrawedElement == null)
collection.Add(ellipse);
DrawedElement = ellipse;
}
开发者ID:npke,项目名称:my-paint-windows,代码行数:14,代码来源:MyEllipse.cs
示例19: CreatePart
/// <summary>
/// Create a visual for single Series Part
/// </summary>
/// <returns>
/// UIElement
/// </returns>
public override UIElement CreatePart()
{
Ellipse = new Ellipse();
Binding heightBinding = new Binding {Path = new PropertyPath("Size"), Source = this};
Ellipse.SetBinding(Ellipse.HeightProperty, heightBinding);
Binding widthBinding = new Binding {Path = new PropertyPath("Size"), Source = this};
Ellipse.SetBinding(Ellipse.WidthProperty, widthBinding);
Canvas.SetLeft(Ellipse, X1 - (Ellipse.Width / 2));
Canvas.SetTop(Ellipse, Y1 - (Ellipse.Height / 2));
SetBindingForStrokeandStrokeThickness(Ellipse);
return Ellipse;
}
开发者ID:jcw-,项目名称:sparrowtoolkit,代码行数:20,代码来源:ScatterPart.cs
示例20: EllipsePointTest
public static bool EllipsePointTest(Ellipse ellipse, Vector2D point)
{
double x = point.X;
double y = point.Y;
double a = ellipse.RadiusX;
double b = ellipse.RadiusY;
double xComponent = (Math.Pow(point.X - ellipse.Center.X, 2) / Math.Pow(ellipse.RadiusX, 2));
double yComponent = (Math.Pow(point.Y - ellipse.Center.Y, 2) / Math.Pow(ellipse.RadiusY, 2));
double value = xComponent + yComponent;
if (value < 1)
return true;
return false;
}
开发者ID:yong-ja,项目名称:starodyssey,代码行数:17,代码来源:Intersection.cs
注:本文中的Ellipse类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论