本文整理汇总了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);
}
示例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));
}
}
示例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();
}
}
示例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() + "'." );
}
}
示例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() + "'." );
}
}
示例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);
}
}