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


C# Shape.GetType方法代码示例

本文整理汇总了C#中Shape.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Shape.GetType方法的具体用法?C# Shape.GetType怎么用?C# Shape.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Shape的用法示例。


在下文中一共展示了Shape.GetType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestCreateShapeObject

 public void TestCreateShapeObject()
 {
     //---------------Set up test pack-------------------
     //---------------Execute Test ----------------------
     IBusinessObject objShape = new Shape();
     //---------------Test Result -----------------------
     Assert.AreSame(typeof(Shape), objShape.GetType(),
                    "objShape should be of type Shape, but is of type " + objShape.GetType().Name);
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:9,代码来源:TestBusinessObjectInheritance.cs

示例2: DrawShape

 void DrawShape(Shape shape)
 {
     if (shape.GetType() == typeof (Square))
     {
         DrawSquare((Square) (shape));
     } else if (shape.GetType() == typeof (Triangle))
     {
         DrawTriangle((Triangle) (shape));
     } else if (shape.GetType() == typeof (Circle))
     {
         DrawCircle((Circle) (shape));
     }
 }
开发者ID:7digital,项目名称:Liskov,代码行数:13,代码来源:4.CodeSmells.cs

示例3: Area

 public Area( Shape s )
 {
     if ( s == null ) {
         region = new System.Drawing.Region();
     } else if ( s is Area ) {
         Area a = (Area)s;
         if ( a.region == null ) {
             region = new System.Drawing.Region();
         } else {
             region = (System.Drawing.Region)a.region.Clone();
         }
     } else if ( s is Rectangle ) {
         Rectangle rc = (Rectangle)s;
         region = new System.Drawing.Region( new System.Drawing.Rectangle( rc.x, rc.y, rc.width, rc.height ) );
     } else {
         serr.println(
             "fixme: org.kbinani.java.awt.Area#.ctor(org.kbinani.java.awt.Shape); type of argument s is not supported for '" +
             s.GetType() + "'." );
         region = new System.Drawing.Region();
     }
 }
开发者ID:kixtarte,项目名称:cadencii,代码行数:21,代码来源:awt.cs

示例4: fill

        public void fill( Shape s ) {
            if ( s == null ) {
                return;
            }

            if ( s is Area ) {
                Area a = (Area)s;
                if ( a.region != null ) {
                    nativeGraphics.FillRegion( brush, a.region );
                }
            } else if ( s is Rectangle ) {
                Rectangle rc = (Rectangle)s;
                nativeGraphics.FillRectangle( brush, rc.x, rc.y, rc.width, rc.height );
            } else {
                serr.println(
                    "fixme; org.kbinani.java.awt.Graphics2D#fill; type of argument s is not supported for '" +
                    s.GetType() + "'." );
            }
        }
开发者ID:kixtarte,项目名称:cadencii,代码行数:19,代码来源:awt.cs

示例5: setClip

 public void setClip( Shape clip ) {
     if ( clip == null ) {
         nativeGraphics.Clip = new System.Drawing.Region();
     } else if ( clip is Area ) {
         nativeGraphics.Clip = ((Area)clip).region;
     } else if ( clip is Rectangle ) {
         Rectangle rc = (Rectangle)clip;
         nativeGraphics.Clip = new System.Drawing.Region( new System.Drawing.Rectangle( rc.x, rc.y, rc.width, rc.height ) );
     } else {
         serr.println( 
             "fixme: org.kbinani.java.awt.Graphics#setClip; argument type of clip is not supported for '" +
             clip.GetType() + "'." );
     }
 }
开发者ID:kixtarte,项目名称:cadencii,代码行数:14,代码来源:awt.cs

示例6: AssertIntersect

        private void AssertIntersect(String msg, SpatialRelation expected, Shape a, Shape b)
        {
            SpatialRelation sect = a.Relate(b, ctx);
            if (sect == expected)
                return;
            if (expected == SpatialRelation.WITHIN || expected == SpatialRelation.CONTAINS)
            {
                if (a.GetType() == b.GetType()) // they are the same shape type
                    Assert.Equal(/*msg,*/ a, b);
                else
                {
                    //they are effectively points or lines that are the same location
                    Assert.True(!a.HasArea(), msg);
                    Assert.True(!b.HasArea(), msg);

                    Rectangle aBBox = a.GetBoundingBox();
                    Rectangle bBBox = b.GetBoundingBox();
                    if (aBBox.GetHeight() == 0 && bBBox.GetHeight() == 0
                        && (aBBox.GetMaxY() == 90 && bBBox.GetMaxY() == 90
                            || aBBox.GetMinY() == -90 && bBBox.GetMinY() == -90))
                    {
                        ; //== a point at the pole
                    }
                    else
                    {
                        Assert.Equal( /*msg,*/ aBBox, bBBox);
                    }
                }
            }
            else
            {
                Assert.Equal(/*msg,*/ expected, sect);
            }
        }
开发者ID:ccurrens,项目名称:Spatial4n,代码行数:34,代码来源:AbstractTestShapes.cs


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