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


C# Microsoft.Office.Interop.Visio.DrawPolyline方法代码示例

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


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

示例1: Render

        public void Render(IVisio.Page page)
        {
            this.TotalMarginWidth = this.Rectangle.Width*(0.10);

            int num_points = this.DataPoints.Count;
            double bar_spacing = num_points > 1 ? (this.Rectangle.Width-this.TotalBarWidth)/num_points : 0.0;

            // Calculate min & max which will be used many times later
            double max = this.DataPoints.Select(i => i.Value).Max();
            double min = this.DataPoints.Select(i => i.Value).Min();
            var range = ChartUtil.GetValueRangeDistance(min, max);

            // Determine the leftmost part of the drawing area
            double base_x = this.Rectangle.Left + (this.TotalMarginWidth / 2.0);

            // Determine the baseline height a.k.a the y axis location
            double base_y = this.Rectangle.Bottom;
            if (min < 0.0)
            {
                // if the min value is negative then we have to "raise" the baseline to accomodate it
                base_y += System.Math.Abs(this.Rectangle.Height * (min / range));
            }

            var category_axis_start_point = new Drawing.Point(this.Rectangle.Left, base_y);
            var category_axis_end_point = new Drawing.Point(this.Rectangle.Right, base_y);
            var category_axis_shape = page.DrawLine(category_axis_start_point, category_axis_end_point);

            double cur_x = base_x;

            var points = new List<Drawing.Point>();
            for (int i = 0; i < this.DataPoints.Count; i++)
            {
                if (i == 0)
                {
                    points.Add( new Drawing.Point(cur_x,base_y));
                }

                var p = this.DataPoints[i];

                var value_height = System.Math.Abs(this.Rectangle.Height*(p.Value/range));

                if (p.Value >= 0.0)
                {
                    points.Add(new Drawing.Point(cur_x, base_y+value_height));
                }
                else
                {
                    points.Add(new Drawing.Point(cur_x , base_y - value_height));

                }

                if (i == this.DataPoints.Count - 1)
                {
                    points.Add(new Drawing.Point(cur_x, base_y));
                }

                cur_x += bar_spacing;
            }

            points.Add(new Drawing.Point(base_x, base_y));

            var area_shape = page.DrawPolyline(points);

            var allshapes = this.DataPoints.Select(dp => dp.VisioShape).Where(s => s != null).ToList();
            allshapes.Add(category_axis_shape);

            ChartUtil.GroupShapesIfNeeded(page, allshapes);
        }
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:68,代码来源:AreaChart.cs


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