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


C# GraphicsPath.Flatten方法代码示例

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


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

示例1: GetArrowLinePoints

    public static List<PointF> GetArrowLinePoints(float x1, float y1, float x2, float y2, float extra_thickness = 0)
    {
        var widthX	= (x2 - x1);
        var lengthX = Math.Max(60, Math.Abs(widthX / 2))
            //+ Math.Max(0, -widthX / 2)
            ;
        var lengthY = 0;// Math.Max(-170, Math.Min(-120.0f, widthX - 120.0f)) + 120.0f;
        if (widthX < 120)
            lengthX = 60;
        var yB = ((y1 + y2) / 2) + lengthY;// (y2 + ((y1 - y2) / 2) * 0.75f) + lengthY;
        var yC = y2 + yB;
        var xC = (x1 + x2) / 2;
        var xA = x1 + lengthX;
        var xB = x2 - lengthX;

        /*
            if (widthX >= 120)
            {
                xA = xB = xC = x2 - 60;
            }
            //*/

        var points = new List<PointF>
        {
            new PointF(x1, y1),
            new PointF(xA, y1),
            new PointF(xB, y2),
            new PointF(x2 - GraphConstants.ConnectorSize - extra_thickness, y2)
        };

        var t  = 1.0f;//Math.Min(1, Math.Max(0, (widthX - 30) / 60.0f));
        var yA = (yB * t) + (yC * (1 - t));

        if (widthX <= 120)
        {
            points.Insert(2, new PointF(xB, yA));
            points.Insert(2, new PointF(xC, yA));
            points.Insert(2, new PointF(xA, yA));
        }
        //*
        using (var tempPath = new GraphicsPath())
        {
            tempPath.AddBeziers(points.ToArray());
            tempPath.Flatten();
            points = tempPath.PathPoints.ToList();
        }
        return points;
    }
开发者ID:idursun,项目名称:StateMachines,代码行数:48,代码来源:GraphUtils.cs


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