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


C# Shape.ToString方法代码示例

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


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

示例1: ToStringModelView

 public static void ToStringModelView(Shape shape, int nest, ref StringBuilder sb)
 {
     if (shape is ShapeProxy)
     {
         ((ShapeProxy)shape).ToStringModelView(nest, ref sb);
     }
     else if (shape is UnparsedShape)
     {
         ((UnparsedShape)shape).ToStringModelView(nest, ref sb);
     }
     else if (shape is MorphShapeProxy)
     {
         ((MorphShapeProxy)shape).ToStringModelView(nest, ref sb);
     }
     else if (shape is UnparsedMorphShape)
     {
         ((UnparsedMorphShape)shape).ToStringModelView(nest, ref sb);
     }
     else
     {
         throw new Exception("*** ERROR: CAN'T DUMP: " + shape.ToString());
     }
 }
开发者ID:WeeWorld,项目名称:Swiffotron,代码行数:23,代码来源:ShapeDump.cs

示例2: WriteShape

        /// <summary>
        /// Writes a shape to a String, in a format that can be read by {@link #readShape(String)}.
        /// </summary>
        /// <param name="shape"></param>
        /// <returns></returns>
        public virtual String WriteShape(Shape shape)
        {
            // TODO: Support Java's NumberFormat behavior

            var point = shape as Point;
            if (point != null)
            {
                return point.GetX().ToString("F6", CultureInfo.CreateSpecificCulture("en-US")) + " " +
                       point.GetY().ToString("F6", CultureInfo.CreateSpecificCulture("en-US"));
            }

            var rect = shape as Rectangle;
            if (rect != null)
            {
                return rect.GetMinX().ToString("F6", CultureInfo.CreateSpecificCulture("en-US")) + " " +
                       rect.GetMinY().ToString("F6", CultureInfo.CreateSpecificCulture("en-US")) + " " +
                       rect.GetMaxX().ToString("F6", CultureInfo.CreateSpecificCulture("en-US")) + " " +
                       rect.GetMaxY().ToString("F6", CultureInfo.CreateSpecificCulture("en-US"));
            }

            var c = shape as Circle;
            if (c != null)
            {
                return "Circle(" +
                       c.GetCenter().GetX().ToString("F6", CultureInfo.CreateSpecificCulture("en-US")) + " " +
                       c.GetCenter().GetY().ToString("F6", CultureInfo.CreateSpecificCulture("en-US")) + " " +
                       "d=" + c.GetRadius().ToString("F6", CultureInfo.CreateSpecificCulture("en-US")) +
                       ")";
            }

            return shape.ToString();
        }
开发者ID:e-tobi,项目名称:Spatial4n,代码行数:37,代码来源:ShapeReadWriter.cs

示例3: ShapeToString

 public static string ShapeToString(string attr, Shape shape) {
     return attr + shape.ToString().ToLower();
 }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:3,代码来源:DrawingEnums.cs


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