本文整理汇总了C#中RectangleF.Inflate方法的典型用法代码示例。如果您正苦于以下问题:C# RectangleF.Inflate方法的具体用法?C# RectangleF.Inflate怎么用?C# RectangleF.Inflate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RectangleF
的用法示例。
在下文中一共展示了RectangleF.Inflate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestInflate
public void TestInflate() {
RectangleF testRectangle = new RectangleF(1.2f, 3.4f, 5.6f, 7.8f);
testRectangle.Inflate(10.0f, 100.0f);
Assert.That(testRectangle.X, Is.EqualTo(-8.8f).Within(4).Ulps);
Assert.That(testRectangle.Y, Is.EqualTo(-96.6f).Within(4).Ulps);
Assert.That(testRectangle.Width, Is.EqualTo(25.6f).Within(4).Ulps);
Assert.That(testRectangle.Height, Is.EqualTo(207.8f).Within(4).Ulps);
}
示例2: InflateTest
public void InflateTest(float x, float y, float width, float height)
{
RectangleF rect = new RectangleF(x, y, width, height);
RectangleF inflatedRect = new RectangleF(x - width, y - height, width + 2 * width, height + 2 * height);
rect.Inflate(width, height);
Assert.Equal(inflatedRect, rect);
SizeF s = new SizeF(x, y);
inflatedRect = RectangleF.Inflate(rect, x, y);
rect.Inflate(s);
Assert.Equal(inflatedRect, rect);
}
示例3: InflateTest
public void InflateTest()
{
RectangleF target = new RectangleF(0f, 0f, 100f, 100f);
float horizontalAmount = 2f;
float verticalAmount = 2f;
target.Inflate(horizontalAmount, verticalAmount);
Assert.AreEqual(-2f, target.X);
Assert.AreEqual(-2f, target.Y);
Assert.AreEqual(102f, target.Right);
Assert.AreEqual(102f, target.Bottom);
}
示例4: drawPoints
private void drawPoints(Bgr<byte>[,] im, List<PointF> points)
{
foreach (var pt in points)
{
var rect = new RectangleF(pt.X, pt.Y, 1, 1);
rect.Inflate(winSize / 2, winSize / 2);
im.Draw(rect, Bgr<byte>.Red, 2);
}
}
示例5: InflateRect
public static RectangleF InflateRect(RectangleF rect, float delta)
{
rect.Inflate(delta, delta);
return rect;
}
示例6: TestInflate
public void TestInflate()
{
RectangleF testRectangle = new RectangleF(1.2f, 3.4f, 5.6f, 7.8f);
testRectangle.Inflate(10.0f, 100.0f);
Assert.AreEqual(-8.8f, testRectangle.X, .0004);
Assert.AreEqual(-96.6f, testRectangle.Y, .0004);
Assert.AreEqual(25.6f, testRectangle.Width, .0004);
Assert.AreEqual(207.8f, testRectangle.Height, .0004);
}