本文整理汇总了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);
}
示例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);
}