本文整理汇总了C#中Point.Round方法的典型用法代码示例。如果您正苦于以下问题:C# Point.Round方法的具体用法?C# Point.Round怎么用?C# Point.Round使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point
的用法示例。
在下文中一共展示了Point.Round方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RoundTest
public void RoundTest( float x, float y, int expectedX, int expectedY )
{
Point point = new Point( x, y );
IntPoint iPoint = new IntPoint( expectedX, expectedY );
Assert.AreEqual( iPoint, point.Round( ) );
}
示例2: GetCurrentWindowPosition
/// <summary>
/// Gets current window position taking into account animation effects.
/// </summary>
/// <returns>Current window position.</returns>
private Point GetCurrentWindowPosition()
{
var transformGroup = contentRoot.RenderTransform as TransformGroup;
var translateTransform = transformGroup.Children.OfType<TranslateTransform>().FirstOrDefault();
var position = new Point(translateTransform.X, translateTransform.Y);
// Round coordinates to avoid blured window
return position.Round();
}
示例3: IsEqual
public bool IsEqual(Point p, int round)
{
if (round >= 0)
{
Point p1 = this.Round(round);
Point p2 = p.Round(round);
return p1.X == p2.X && p1.Y == p2.Y;
}
return this.X == p.X && this.Y == p.Y;
}
示例4: Line
public Line(Point startPoint, Point endPoint, int decimals = 0)
: this()
{
this.StartPoint = startPoint.Round(decimals);
this.EndPoint = endPoint.Round(decimals);
}