当前位置: 首页>>代码示例>>C#>>正文


C# RectangleF.Equals方法代码示例

本文整理汇总了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);
        }
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:8,代码来源:RectangleFTests.cs

示例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);
        }
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:15,代码来源:RectangleFTests.cs

示例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;
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:22,代码来源:SpriteScissorStack.cs

示例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)));
 }
开发者ID:geoffkizer,项目名称:corefx,代码行数:7,代码来源:RectangleFTests.cs

示例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));
        }
开发者ID:geoffkizer,项目名称:corefx,代码行数:9,代码来源:RectangleFTests.cs

示例6: TestEqualsWithNullReference

    public void TestEqualsWithNullReference() {
      RectangleF testRectangle = new RectangleF(1.2f, 3.4f, 5.6f, 7.8f);

      Assert.IsFalse(testRectangle.Equals(null));
    }
开发者ID:pr0gramm3r1,项目名称:AngryTanks,代码行数:5,代码来源:RectangleF.Test.cs

示例7: TestEqualsWithDifferentType

    public void TestEqualsWithDifferentType() {
      RectangleF testRectangle = new RectangleF(1.2f, 3.4f, 5.6f, 7.8f);

      Assert.IsFalse(testRectangle.Equals(DateTime.MinValue));
    }
开发者ID:pr0gramm3r1,项目名称:AngryTanks,代码行数:5,代码来源:RectangleF.Test.cs

示例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));
    }
开发者ID:pr0gramm3r1,项目名称:AngryTanks,代码行数:8,代码来源:RectangleF.Test.cs

示例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));
        }
开发者ID:shadercoder,项目名称:Icicle-Framework,代码行数:9,代码来源:RectangleFTest.cs


注:本文中的RectangleF.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。