本文整理汇总了C#中RectangleF.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# RectangleF.Equals方法的具体用法?C# RectangleF.Equals怎么用?C# RectangleF.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RectangleF
的用法示例。
在下文中一共展示了RectangleF.Equals方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RectangleF_EqualsObject
public void RectangleF_EqualsObject()
{
var rectangle1 = new RectangleF(123.45f, 456.78f, 789.99f, 999.99f);
var rectangle2 = new RectangleF(123.45f, 456.78f, 789.99f, 999.99f);
TheResultingValue(rectangle1.Equals((Object)rectangle2)).ShouldBe(true);
TheResultingValue(rectangle1.Equals("This is a test")).ShouldBe(false);
}
示例2: RectangleF_EqualsRectangleF
public void RectangleF_EqualsRectangleF()
{
var rectangle1 = new RectangleF(123.45f, 456.78f, 789.99f, 999.99f);
var rectangle2 = new RectangleF(123.45f, 456.78f, 789.99f, 999.99f);
var rectangle3 = new RectangleF(222f, 456.78f, 789.99f, 999.99f);
var rectangle4 = new RectangleF(123.45f, 333f, 789.99f, 999.99f);
var rectangle5 = new RectangleF(123.45f, 456.78f, 444f, 999.99f);
var rectangle6 = new RectangleF(123.45f, 456.78f, 789.99f, 555f);
TheResultingValue(rectangle1.Equals(rectangle2)).ShouldBe(true);
TheResultingValue(rectangle1.Equals(rectangle3)).ShouldBe(false);
TheResultingValue(rectangle1.Equals(rectangle4)).ShouldBe(false);
TheResultingValue(rectangle1.Equals(rectangle5)).ShouldBe(false);
TheResultingValue(rectangle1.Equals(rectangle6)).ShouldBe(false);
}
示例3: Cut
/// <summary>
/// Cuts the destination rectangle using top of the scissor stack.
/// Source rectangle is modified using scaled change of destination
/// as well.
/// </summary>
public void Cut(ref RectangleF destination, ref RectangleF source)
{
if (Empty)
return;
var originalDestination = destination;
Rectangle top = m_rectangleStack.Peek();
var topF = new RectangleF(top.X, top.Y, top.Width, top.Height);
RectangleF.Intersect(ref destination, ref topF, out destination);
if (destination.Equals(originalDestination))
return;
var scale = source.Size / originalDestination.Size;
var sizeChange = destination.Size - originalDestination.Size;
var positionChange = destination.Position - originalDestination.Position;
var originalSource = source;
source.Position += positionChange * scale;
source.Size += sizeChange * scale;
}
示例4: EqualityTest_NotRectangleF
public static void EqualityTest_NotRectangleF()
{
var rectangle = new RectangleF(0, 0, 0, 0);
Assert.False(rectangle.Equals(null));
Assert.False(rectangle.Equals(0));
Assert.False(rectangle.Equals(new Rectangle(0, 0, 0, 0)));
}
示例5: EqualityTest
public void EqualityTest(float x, float y, float width, float height)
{
RectangleF rect1 = new RectangleF(x, y, width, height);
RectangleF rect2 = new RectangleF(width, height, x, y);
Assert.True(rect1 != rect2);
Assert.False(rect1 == rect2);
Assert.False(rect1.Equals(rect2));
}
示例6: TestEqualsWithNullReference
public void TestEqualsWithNullReference() {
RectangleF testRectangle = new RectangleF(1.2f, 3.4f, 5.6f, 7.8f);
Assert.IsFalse(testRectangle.Equals(null));
}
示例7: TestEqualsWithDifferentType
public void TestEqualsWithDifferentType() {
RectangleF testRectangle = new RectangleF(1.2f, 3.4f, 5.6f, 7.8f);
Assert.IsFalse(testRectangle.Equals(DateTime.MinValue));
}
示例8: TestEqualsWithDowncast
public void TestEqualsWithDowncast() {
RectangleF testRectangle = new RectangleF(1.2f, 3.4f, 5.6f, 7.8f);
RectangleF equivalentRectangle = new RectangleF(1.2f, 3.4f, 5.6f, 7.8f);
RectangleF differingRectangle = new RectangleF(3.0f, 6.0f, 3.7f, 5.2f);
Assert.IsTrue(testRectangle.Equals((object)equivalentRectangle));
Assert.IsFalse(testRectangle.Equals((object)differingRectangle));
}
示例9: EqualsTest1
public void EqualsTest1()
{
RectangleF target = new RectangleF(101f, 105f, 65f, 35f);
object compareTrue = new RectangleF(101f, 105f, 65f, 35f);
object compareFalse = new RectangleF(10f, 5f, 101f, 1000f);
Assert.IsTrue(target.Equals(compareTrue));
Assert.IsFalse(target.Equals(compareFalse));
}