本文整理汇总了C#中System.Drawing.Graphics.DrawPie方法的典型用法代码示例。如果您正苦于以下问题:C# Graphics.DrawPie方法的具体用法?C# Graphics.DrawPie怎么用?C# Graphics.DrawPie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Graphics
的用法示例。
在下文中一共展示了Graphics.DrawPie方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public void Render(Graphics graphics)
{
graphics.DrawPie(
_pen,
_rectangle,
_startAngle,
_endAngle);
}
示例2: dataRcvd_Received
void dataRcvd_Received(object serder, Event.dataRcvdEventArgs data)
{
double alpha = fft1.get_now_alpha(data.data, data.length, 27);
double beta = fft1.get_now_beta(data.data, data.length, 27);
if (alpha <= data.total_alpha && beta <= data.total_beta)
{
last_point = now_point;
now_point.X = (int)(alpha * this.Width / data.total_alpha);
now_point.Y = (int)(this.Width - beta * this.Width / data.total_beta);
}
g = panel1.CreateGraphics();
g.DrawPie(new Pen(Color.Red), now_point.X - 5, now_point.Y - 5, 10, 10, 0, 360);
g.DrawLine(new Pen(Color.Cyan), last_point, now_point);
}
示例3: Dibujar_Diente
public void Dibujar_Diente()
{
Bitmap area_de_dibujo = new Bitmap(pictureBox.Width, pictureBox.Height);
g = Graphics.FromImage(area_de_dibujo);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
g.FillPie(new SolidBrush(colores_partes[1]), 0, 0, 40, 40, 225, 90);
g.FillPie(new SolidBrush(colores_partes[2]), 0, 0, 40, 40, -45, 90);
g.FillPie(new SolidBrush(colores_partes[3]), 0, 0, 40, 40, 45, 90);
g.FillPie(new SolidBrush(colores_partes[4]), 0, 0, 40, 40, 135, 90);
Pen p = new Pen(Color.Black);
g.DrawPie(p, 0, 0, 40, 40, 225, 90);
g.DrawPie(p, 0, 0, 40, 40, -45, 90);
g.DrawPie(p, 0, 0, 40, 40, 45, 90);
g.DrawPie(p, 0, 0, 40, 40, 135, 90);
g.FillEllipse(new SolidBrush(colores_partes[0]), 11.5f, 11.5f, 17f, 17f);
g.DrawEllipse(Pens.Black, 11.5f, 11.5f, 17.0f, 17.0f);
pictureBox.Image = area_de_dibujo;
}
示例4: Show
public override void Show(Graphics g)
{
Pen whitePen = new Pen(Color.White, 3);
int x = LeftTop.X;
int y = LeftTop.Y;
int width = RightBottom.X - LeftTop.X;
int height = RightBottom.Y - LeftTop.Y;
Random pie_ran = new Random();
int startAngle = pie_ran.Next(1,360);
int sweepAngle = pie_ran.Next(1,360);
g.DrawPie(whitePen, x, y, width, height, startAngle, sweepAngle);
g.FillPie(Brushes.Black, x, y, width, height, startAngle, sweepAngle);
}
示例5: 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);
}
示例6: RenderObject
public override void RenderObject(Graphics g, DrawContext dcxt)
{
if (fill)
g.FillPie(BrushWhenCxt(dcxt).Brush, dcxt.X_V2S(x-w/2), dcxt.Y_V2S(y-h/2), dcxt.W_V2S(w), dcxt.W_V2S(h), startagl, sweepagl);
else
g.DrawPie(PenWhenCxt(dcxt).Pen, dcxt.X_V2S(x - w / 2), dcxt.Y_V2S(y - h / 2), dcxt.W_V2S(w), dcxt.W_V2S(h), startagl, sweepagl);
}
示例7: DrawHover
public void DrawHover(Graphics graphics, Rectangle bounds, double hoverDone)
{
int x = bounds.X + (bounds.Width / 2);
int y = bounds.Y + (bounds.Height / 2);
if (mFill) {
using (Brush b = new SolidBrush(mHoverColour))
graphics.FillPie(b, x - mR, y - mR, mR * 2, mR * 2, -90, (int)(hoverDone * 360f));
} else
using (Pen p = new Pen(mHoverColour))
graphics.DrawPie(p, x - mR, y - mR, mR * 2, mR * 2, -90, (int)(hoverDone * 360f));
}
示例8: Draw2D
/// <summary>
/// draw the coordinate system
/// </summary>
/// <param name="graphics">form graphic</param>
/// <param name="pen">pen used to draw line in pictureBox</param>
/// <param name="matrix4">Matrix used to transform 3d to 2d
/// and make picture in right scale </param>
public override void Draw2D(Graphics graphics, Pen pen, Matrix4 matrix4)
{
graphics.Transform = new System.Drawing.Drawing2D.Matrix(
1, 0, 0, 1, 0, 0);
//draw X axis
graphics.DrawLine(pen, new Point(20, 280), new Point(400, 280));
graphics.DrawPie(pen, 400, 265, 30, 30, 165, 30);
//draw Y axis
graphics.DrawLine(pen, new Point(20, 280), new Point(20, 50));
graphics.DrawPie(pen, 5, 20, 30, 30, 75, 30);
//draw scale
graphics.DrawLine(pen, new Point(120, 275), new Point(120, 285));
graphics.DrawLine(pen, new Point(220, 275), new Point(220, 285));
graphics.DrawLine(pen, new Point(320, 275), new Point(320, 285));
graphics.DrawLine(pen, new Point(15, 80), new Point(25, 80));
graphics.DrawLine(pen, new Point(15, 180), new Point(25, 180));
//dimension
Font font = new Font("Verdana", 10, FontStyle.Regular);
graphics.DrawString("100'", font, Brushes.Blue, new PointF(122, 266));
graphics.DrawString("200'", font, Brushes.Blue, new PointF(222, 266));
graphics.DrawString("300'", font, Brushes.Blue, new PointF(322, 266));
graphics.DrawString("100'", font, Brushes.Blue, new PointF(22, 181));
graphics.DrawString("200'", font, Brushes.Blue, new PointF(22, 81));
graphics.DrawString("(0,0)", font, Brushes.Blue, new PointF(10, 280));
}
示例9: RePain
public new void RePain(float Dlg, float Dlv, bool Fill, float k, Graphics G)
{
if (TypeShape == Nows.Ellip)
{
if (Fill) G.FillEllipse(new SolidBrush(Col), (Xn - Dlg) * k, (Yn - Dlv) * k, Width * k, Height * k);
G.DrawEllipse(new Pen(BorderCol, BorderWidth), (Xn - Dlg) * k, (Yn - Dlv) * k, Width * k, Height * k);
}
else
{
if (Fill) G.FillPie(new SolidBrush(Col), (Xn - Dlg) * k, (Yn - Dlv ) * k, Width * k, Height * k, startAngle, sweepAngle);
G.DrawPie(new Pen(BorderCol, BorderWidth), (Xn - Dlg) * k, (Yn - Dlv) * k, Width * k, Height * k, startAngle, sweepAngle);
}
}
示例10: Draw
/// <summary>
/// Do all rendering associated with this <see cref="GasGaugeRegion"/> item to the specified
/// <see cref="Graphics"/> device. This method is normally only
/// called by the Draw method of the parent <see cref="ZedGraph.CurveList"/>
/// collection object.
/// </summary>
/// <param name="g">
/// A graphic device object to be drawn into. This is normally e.Graphics from the
/// PaintEventArgs argument to the Paint() method.
/// </param>
/// <param name="pane">
/// A reference to the <see cref="ZedGraph.GraphPane"/> object that is the parent or
/// owner of this object.
/// </param>
/// <param name="pos">Not used for rendering GasGaugeNeedle</param>
/// <param name="scaleFactor">
/// The scaling factor to be used for rendering objects. This is calculated and
/// passed down by the parent <see cref="ZedGraph.GraphPane"/> object using the
/// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust
/// font sizes, etc. according to the actual size of the graph.
/// </param>
public override void Draw(Graphics g, GraphPane pane, int pos, float scaleFactor)
{
if (pane.Chart._rect.Width <= 0 && pane.Chart._rect.Height <= 0) {
_slicePath = null;
}
else {
CalcRectangle(g, pane, scaleFactor, pane.Chart._rect);
_slicePath = new GraphicsPath();
if (!_isVisible)
return;
RectangleF tRect = _boundingRectangle;
if (tRect.Width >= 1 && tRect.Height >= 1) {
SmoothingMode sMode = g.SmoothingMode;
g.SmoothingMode = SmoothingMode.AntiAlias;
_slicePath.AddPie(tRect.X, tRect.Y, tRect.Width, tRect.Height,
-0.0f, -180.0f);
g.FillPie(Fill.MakeBrush(_boundingRectangle), tRect.X, tRect.Y, tRect.Width, tRect.Height, -StartAngle, -SweepAngle);
if (this.Border.IsVisible) {
Pen borderPen = _border.GetPen(pane, scaleFactor);
g.DrawPie(borderPen, tRect.X, tRect.Y, tRect.Width, tRect.Height,
-0.0f, -180.0f);
borderPen.Dispose();
}
g.SmoothingMode = sMode;
}
}
}
示例11: DrawTop
/// <summary>
/// Draws the top of the pie slice.
/// </summary>
/// <param name="graphics">
/// <c>Graphics</c> used to draw the pie slice.
/// </param>
internal void DrawTop(Graphics graphics) {
graphics.FillPie(m_brushSurface, m_boundingRectangle.X, m_boundingRectangle.Y, m_boundingRectangle.Width, m_boundingRectangle.Height, m_startAngle, m_sweepAngle);
graphics.DrawPie(m_pen, m_boundingRectangle, m_startAngle, m_sweepAngle);
}
示例12: DrawPie
public static void DrawPie(Graphics g, DiagramView view, System.Drawing.Pen pen, System.Drawing.Brush brush, float x, float y, float width, float height, float startangle, float sweepangle)
{
if (brush != null)
{
g.FillPie(brush, x, y, width, height, startangle, sweepangle);
}
if (pen != null)
{
g.DrawPie(pen, x, y, width, height, startangle, sweepangle);
}
}
示例13: DrawClickCount
//##################################################################################
public virtual void DrawClickCount(Graphics g, int count, int x, int y)
{
using (Pen pen = new Pen(Color.DarkBlue, 3.0f))
{
g.DrawPie(pen, x, y, 32.0f, 32.0f,
65.0f, count * 36.0f);
}
}
示例14: DrawChessShadow
private void DrawChessShadow(Graphics g, Rectangle r)
{
if (panelBoard.Cursor != Cursors.Hand)
{
return;
}
if (m_ShadowChessX == -1 || m_ShadowChessY == -1)
{
return;
}
int radius = 18 - 2;
Point p = CalculateChessLocation(m_ShadowChessX, m_ShadowChessY);
g.DrawPie(new Pen(Color.Blue), p.X - radius, p.Y - radius, 2*radius +1, 2 *radius +1, 0, 360);
}
示例15: draw
/// <summary>
/// Draws the radar to the screen.
/// </summary>
public void draw(Graphics g, CoordinateFrame frame)
{
Brush b = new SolidBrush(Color.Green);
Size s = new Size((int)((MaxRange) / frame.Scale), (int)((MaxRange) / frame.Scale));
if (Type == "directedVoiceNOTASENSOR") // Special drawing rules for this Type of sensor (used for showing communication)
{
if (Activation < 0.1)
{
s = new Size((int)((MaxRange * 1.0) / frame.Scale), (int)((MaxRange * 1.0) / frame.Scale));
b = new SolidBrush(Color.FromArgb((int)(0), 128, 128, 128));
}
else
{
s = new Size((int)((MaxRange * Activation) / frame.Scale), (int)((MaxRange * Activation) / frame.Scale));
b = new SolidBrush(Color.FromArgb((int)(80), 200, 0, 200));
}
g.FillPie(b, new Rectangle(frame.convertToDisplay((float)(Owner.AreaOfImpact.Position.X), (float)(Owner.AreaOfImpact.Position.Y)) - new Size(s.Width / 2, s.Height / 2), s), (float)StartAngle + (float)(Owner.Heading * 57.2957795), (float)(EndAngle - StartAngle));
return;
}
Rectangle r = new Rectangle(frame.convertToDisplay((float)(Owner.AreaOfImpact.Position.X), (float)(Owner.AreaOfImpact.Position.Y)),s);
if (Activation == 0)
{
if(Type == "goal")
g.DrawPie(EngineUtilities.GreendPen, new Rectangle(frame.convertToDisplay((float)(Owner.AreaOfImpact.Position.X), (float)(Owner.AreaOfImpact.Position.Y)) - new Size(s.Width / 2, s.Height / 2), s), (float)StartAngle + (float)(Owner.Heading * 57.2957795), (float)(EndAngle - StartAngle));
else
g.DrawPie(EngineUtilities.RedPen, new Rectangle(frame.convertToDisplay((float)(Owner.AreaOfImpact.Position.X), (float)(Owner.AreaOfImpact.Position.Y)) - new Size(s.Width / 2, s.Height / 2), s), (float)StartAngle + (float)(Owner.Heading * 57.2957795), (float)(EndAngle - StartAngle));
}
else
{
if (Type == "goal")
{
b = new SolidBrush(Color.FromArgb((int)(Activation * 255), 0, 255, 0));
g.FillPie(b, new Rectangle(frame.convertToDisplay((float)(Owner.AreaOfImpact.Position.X), (float)(Owner.AreaOfImpact.Position.Y)) - new Size(s.Width / 2, s.Height / 2), s), (float)StartAngle + (float)(Owner.Heading * 57.2957795), (float)(EndAngle - StartAngle));
}
else
{
b = new SolidBrush(Color.FromArgb((int)(Activation * 255), 255, 0, 0));
g.FillPie(b, new Rectangle(frame.convertToDisplay((float)(Owner.AreaOfImpact.Position.X), (float)(Owner.AreaOfImpact.Position.Y)) - new Size(s.Width / 2, s.Height / 2), s), (float)StartAngle + (float)(Owner.Heading * 57.2957795), (float)(EndAngle - StartAngle));
}
}
}