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


C# LineCap.ToString方法代码示例

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


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

示例1: DrawEndAnchor

        private void DrawEndAnchor(LineCap lc, CustomLineCap clc, Color col, float w, PointF pt, float angle, bool ignoreUnsupportedLineCaps)
        {
            SvgStyledTransformedElement anchor = null;
            PointF[] points = null;

            switch (lc) {
                case LineCap.NoAnchor:
                    break;

                case LineCap.Flat:
                    // TODO: what is the correct look?
                    break;

                case LineCap.ArrowAnchor:
                    points = new PointF[3];
                    points[0] = new PointF(0, -w / 2f);
                    points[1] = new PointF(-w, w);
                    points[2] = new PointF(w, w);
                    anchor = new SvgPolygonElement(points);
                    break;

                case LineCap.DiamondAnchor:
                    points = new PointF[4];
                    points[0] = new PointF(0, -w);
                    points[1] = new PointF(w, 0);
                    points[2] = new PointF(0, w);
                    points[3] = new PointF(-w, 0);
                    anchor = new SvgPolygonElement(points);
                    break;

                case LineCap.RoundAnchor:
                    anchor = new SvgEllipseElement(0, 0, w, w);
                    break;

                case LineCap.SquareAnchor:
                    float ww = (w / 3) * 2;
                    anchor = new SvgRectElement(0 - ww, 0 - ww, ww * 2, ww * 2);
                    break;

                case LineCap.Custom:
                    if (clc != null)
                    {
                        if (!ignoreUnsupportedLineCaps)
                            throw new SvgGdiNotImpl("DrawEndAnchor custom");
                    }
                    break;

                default:
                    if (!ignoreUnsupportedLineCaps)
                        throw new SvgGdiNotImpl("DrawEndAnchor " + lc.ToString());
                    break;
            }

            if (anchor == null)
                return;

            anchor.Id += "_line_anchor";
            anchor.Style.Set("fill", new SvgColor(col));
            anchor.Style.Set("stroke", "none");

            Matrix rotation = new Matrix();
            rotation.Rotate((angle / (float)Math.PI) * 180);
            Matrix translation = new Matrix();
            translation.Translate(pt.X, pt.Y);

            anchor.Transform = new SvgTransformList(_transforms.Result.Clone());
            anchor.Transform.Add(translation);
            anchor.Transform.Add(rotation);
            _cur.AddChild(anchor);
        }
开发者ID:hnafar,项目名称:SvgNet,代码行数:70,代码来源:SVGGraphics.cs


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