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


C# Graphics.DrawPie方法代码示例

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


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

示例1: Draw

		// Draw this path object.
		public override void Draw(Graphics graphics, Pen pen)
				{
					// TODO brubbel: calculate points and draw lines
					graphics.DrawPie(pen, x, y, width, height,
									 startAngle, sweepAngle);
				}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:GraphicsPath.cs

示例2: Plot

        public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
        {
            if (Bars == null)
                return;

            byte bRed	= (byte)~(ChartControl.BackColor.R);
            byte bGreen	= (byte)~(ChartControl.BackColor.G);
            byte bBlue	= (byte)~(ChartControl.BackColor.B);

            Color borderColor = Color.FromArgb(bRed, bGreen, bBlue);

            if (lineWidth > 0)
            {
                // draw back lines
                Pen linePen = new Pen(lineBrush, lineWidth);
                double lineSpace = 100;

                {
                    double y = (bounds.Y + bounds.Height) - ((0 - min) / ChartControl.MaxMinusMin(max, min)) * bounds.Height;
                    graphics.DrawLine(linePen, ChartControl.CanvasLeft, (int)y, ChartControl.CanvasRight, (int)y);
                }
                while (max > lineSpace || min < lineSpace * -1)
                {
                    double y = (bounds.Y + bounds.Height) - ((lineSpace - min) / ChartControl.MaxMinusMin(max, min)) * bounds.Height;
                    graphics.DrawLine(linePen, ChartControl.CanvasLeft, (int)y, ChartControl.CanvasRight, (int)y);
                    y = (bounds.Y + bounds.Height) - (((lineSpace * -1) - min) / ChartControl.MaxMinusMin(max, min)) * bounds.Height;
                    graphics.DrawLine(linePen, ChartControl.CanvasLeft, (int)y, ChartControl.CanvasRight, (int)y);

                    lineSpace += 100;
                }
            }

            int bars			= ChartControl.BarsPainted;
            int barPaintWidth	= ChartControl.ChartStyle.GetBarPaintWidth(ChartControl.BarWidth);

            if (ChartControl.LastBarPainted - ChartControl.BarsPainted + 1 + bars - Bars.Count != 0)
                bars--;

            while (bars >= 0)
            {
                int index = ((ChartControl.LastBarPainted - ChartControl.BarsPainted) + 1) + bars;

                if (ChartControl.ShowBarsRequired || index - Displacement >= BarsRequired)
                    try
                    {
                        double cciVal = CciPlot.Get(index);
                        int x = (((ChartControl.CanvasRight - ChartControl.BarMarginRight) - (barPaintWidth / 2)) -
                                 ((ChartControl.BarsPainted - 1) * ChartControl.BarSpace)) + (bars * ChartControl.BarSpace);
                        int y1 = (bounds.Y + bounds.Height) - ((int)(((cciVal - min) / ChartControl.MaxMinusMin(max, min)) * bounds.Height));

                        double alertVal = dotSeries.Get(index);

                        if (!double.IsNaN(alertVal) && !double.IsNaN(cciVal))
                        {
                            int y = (bounds.Y + bounds.Height) - ((int)(((0 - min) / ChartControl.MaxMinusMin(max, min)) * bounds.Height));

                            Color dotColor = Color.Transparent;

                            if (Math.Abs(1 - alertVal) < double.Epsilon)
                                dotColor = ChartControl.ChartStyle.UpColor;
                            else if (Math.Abs(-1 - alertVal) < double.Epsilon)
                                dotColor = ChartControl.ChartStyle.DownColor;
                            else if (Math.Abs(2 - alertVal) < double.Epsilon)
                                dotColor = Color.Gray;

                            if (dotColor != Color.Transparent)
                            {
                                int barOffset = (int)((double)(barWidth - 1) / 2);

                                // draw bars
                                if (y1 - y > 0)
                                    graphics.FillRectangle(new SolidBrush(dotColor), x - barOffset, y, barWidth, y1 - y);
                                else
                                    graphics.FillRectangle(new SolidBrush(dotColor), x - barOffset, y1, barWidth, y - y1);

                                if (showDots)
                                {
                                    // draw dots
                                    SmoothingMode smoothingMode = graphics.SmoothingMode;
                                    graphics.SmoothingMode = SmoothingMode.AntiAlias;

                                    Pen pen = new Pen(borderColor, 7) { DashStyle = DashStyle.Dot, DashCap = DashCap.Round };
                                    graphics.DrawPie(pen, x - 1, y, 2, 2, 0, 360);
                                    pen = new Pen(dotColor, 5) { DashStyle = DashStyle.Dot, DashCap = DashCap.Round };
                                    graphics.DrawRectangle(pen, x - 2, y - 1, 2, 2);
                                    graphics.SmoothingMode = smoothingMode;
                                }
                            }
                        }
                    }
                    catch (Exception)
                    {
                    }
                bars--;
            }

            // Default plotting in base class.
            base.Plot(graphics, bounds, min, max);
        }
开发者ID:roonius,项目名称:TradingStudies,代码行数:99,代码来源:AdaptiveCCI.cs


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