本文整理汇总了C#中System.Drawing.Drawing2D.GraphicsPath.AddPie方法的典型用法代码示例。如果您正苦于以下问题:C# GraphicsPath.AddPie方法的具体用法?C# GraphicsPath.AddPie怎么用?C# GraphicsPath.AddPie使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Drawing2D.GraphicsPath
的用法示例。
在下文中一共展示了GraphicsPath.AddPie方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getGraphicsPathNoOffsetRoute
public override GraphicsPath getGraphicsPathNoOffsetRoute()
{
GraphicsPath path = new GraphicsPath();
RectangleF rect = getRect();
try
{
path.AddPie(rect.X, rect.Y, rect.Width, rect.Height, StartAngle, EndAngle);
}
catch (Exception ex)
{
rect.X = _X + _XAdd;
rect.Y = _Y + _YAdd;
rect.Width = 10;
rect.Height = 10;
path.AddPie(rect.X, rect.Y, rect.Width, rect.Height, StartAngle, EndAngle);
////ClsErrorFile.WriteLine("这里是一个扇形出现参数错误,异常处理是构造一个默认宽和高都是10,角度为0和90的扇形", ex);
//throw;
//throw;
}
return path;
//return base.getGraphicsPath();
}
示例2: UpdatePath
protected override void UpdatePath()
{
InternalPath = new GraphicsPath();
InternalPath.AddPie(this.Left, this.Top, this.Width, this.Height, this.StartAngle, this.SweepAngle);
Matrix mtx = new Matrix();
mtx.RotateAt(this.Rotation, InternalRotationBasePoint);
InternalPath.Transform(mtx);
}
示例3: ContainsPoint
public new bool ContainsPoint(float X, float Y)
{
GraphicsPath Path = new GraphicsPath();
Path.StartFigure();
if (TypeShape == Nows.Ellip)
Path.AddEllipse(Rectan);
else
Path.AddPie(Rectan.X, Rectan.Y, Rectan.Width, Rectan.Height, startAngle, sweepAngle);
Path.CloseFigure();
return Path.IsVisible(X, Y);
}
示例4: ArcRenderRange
private static void ArcRenderRange(this Graphics Graphics, Rectangle ClientRectangle, Point Center, Int32 ArcStart, Int32 ArcSweep, Single MinimumValue, Single MaximumValue, ArcRangeDef Range)
{
Graphics.SetClip(ClientRectangle);
Graphics.SmoothingMode = SmoothingMode.HighQuality;
Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
using (var graphicsPath = new GraphicsPath()) {
if (Range.EndValue > Range.StartValue && Range.Enabled) {
var rangeStartAngle = ArcStart + (Range.StartValue - MinimumValue) * ArcSweep / (MaximumValue - MinimumValue);
var rangeSweepAngle = (Range.EndValue - Range.StartValue) * ArcSweep / (MaximumValue - MinimumValue);
graphicsPath.Reset();
graphicsPath.AddPie(new Rectangle(Center.X - Range.OuterRadius, Center.Y - Range.OuterRadius, 2 * Range.OuterRadius, 2 * Range.OuterRadius), rangeStartAngle, rangeSweepAngle);
graphicsPath.Reverse();
graphicsPath.AddPie(new Rectangle(Center.X - Range.InnerRadius, Center.Y - Range.InnerRadius, 2 * Range.InnerRadius, 2 * Range.InnerRadius), rangeStartAngle, rangeSweepAngle);
graphicsPath.Reverse();
Graphics.SetClip(graphicsPath);
using (var solidBrush = new SolidBrush(Range.ForeColor)) {
Graphics.FillPie(solidBrush, new Rectangle(Center.X - Range.OuterRadius, Center.Y - Range.OuterRadius, 2 * Range.OuterRadius, 2 * Range.OuterRadius), rangeStartAngle, rangeSweepAngle);
}
}
}
}
示例5: timer1_Tick
private void timer1_Tick(object sender, EventArgs e)
{
if (fi > 180 || fi < 10) dir *= -1;
fi += dir * 2;
drawDiv();
GraphicsPath path = new GraphicsPath();
path.AddPie((WIDTH - (MAXDIV)) / 2, BASELINE - (((MAXDIV)) / 2), (MAXDIV), (MAXDIV), -fi, 10);
PathGradientBrush brush = new PathGradientBrush(path);
brush.CenterPoint = new PointF(WIDTH-(WIDTH / 2 - (int)(Math.Cos(Deg2Rad((dir>0)?fi:fi-10)) * (MAXDIV / 2))), BASELINE - (int)(Math.Sin(Deg2Rad((dir>0)?fi:fi-10)) * (MAXDIV / 2)));
brush.SurroundColors = new Color[] { Color.FromArgb(0, 0, 255, 0) };
brush.CenterColor = Color.FromArgb(255, 0, 255, 0);
radarGraphic.FillPath(brush, path);
radarGraphic.FillRectangle(Brushes.Black, 0, BASELINE, WIDTH, HEIGHT - BASELINE);
radarScreen.Invalidate();
path.Dispose();
brush.Dispose();
}
示例6: OnResize
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
GraphicsPath path = new GraphicsPath();
path.AddEllipse(this.ClientRectangle);
// ��� ���
#if PIE
path.AddPie(this.ClientRectangle, 0, 90);
#endif
// �ﰢ�� ���
#if Triple
Point[] point = new Point[3];
point[0].X = this.ClientRectangle.Right - this.ClientRectangle.Width / 2;
point[0].Y = this.ClientRectangle.Top;
point[1].X = this.ClientRectangle.Left;
point[1].Y = this.ClientRectangle.Bottom;
point[2].X = this.ClientRectangle.Right;
point[2].Y = this.ClientRectangle.Bottom;
path.AddPolygon(point);
#endif
this.Region = new Region(path);
}
示例7: StartClose_AddPie
public void StartClose_AddPie ()
{
GraphicsPath path = new GraphicsPath ();
path.AddLine (1, 1, 2, 2);
path.AddPie (10, 10, 10, 10, 90, 180);
path.AddLine (10, 10, 20, 20);
byte[] types = path.PathTypes;
// check first types
Assert.AreEqual (0, types[0], "start/Line");
Assert.AreEqual (0, types[2], "start/Pie");
// check last types
// libgdiplus draws pie by ending with a line (not a curve) section
Assert.IsTrue ((types[path.PointCount - 3] & 128) == 128, "end/Pie");
Assert.AreEqual (0, types[path.PointCount - 2], "start/Line2");
Assert.AreEqual (1, types[path.PointCount - 1], "end/Line2");
}
示例8: Flatten_Pie
public void Flatten_Pie ()
{
GraphicsPath path = new GraphicsPath ();
path.AddPie (0, 0, 100, 100, 30, 30);
GraphicsPath clone = (GraphicsPath) path.Clone ();
path.Flatten ();
CompareFlats (path, clone);
}
示例9: GetBounds_NullNull_Pie
public void GetBounds_NullNull_Pie ()
{
GraphicsPath gp = new GraphicsPath ();
gp.AddPie (10, 10, 100, 100, 30, 45);
CheckPieBounds (gp.GetBounds (null, null));
gp.Dispose ();
}
示例10: GetBounds_MatrixEmpty_Pie
public void GetBounds_MatrixEmpty_Pie ()
{
GraphicsPath gp = new GraphicsPath ();
gp.AddPie (10, 10, 100, 100, 30, 45);
CheckPieBounds (gp.GetBounds (new Matrix ()));
gp.Dispose ();
}
示例11: DrawChart
//.........这里部分代码省略.........
gpShp.AddEllipse(LineEndPoint.X - PointDiameter, LineEndPoint.Y - PointDiameter, PointDiameter * 2, PointDiameter * 2);
//- Set End point as Starting point for next Point to draw.
LineSubgroupPoints[i] = LineEndPoint;
}
#endregion
#region "-- PIE --"
else if (_Theme.ChartType == ChartType.Pie)
{
if (!(string.IsNullOrEmpty(DataArr[i])) && DataValue > -1 && DataValueSum > 0)
{
//--Increment Start Angle for next Pie in loop
StartAngle += PieAngle;
if (j == SpCnt - 1)
{
PieAngle = 360 - StartAngle;
}
else
{
PieAngle = (int)(DataValue / DataValueSum * 360); // (decimal.Parse(DataArr[i])
}
gpShp.Reset();
//gpShp.AddPie((int)(PieRectExtent.X + PieRectExtent.Width * 0.5), (int)(PieRectExtent.Y + PieRectExtent.Height * 0.4), (int)(PieRectExtent.Height * 0.5), (int)(PieRectExtent.Height * 0.5), StartAngle, PieAngle);
//gpShp.AddPie((int)(PieRectExtent.X), (int)PieRectExtent.Y, (int)PieRectExtent.Width , (int)PieRectExtent.Height, StartAngle, PieAngle);
if (StartAngle == 0 && PieAngle == 360)
{
gpShp.AddEllipse(ChartExtent);
}
else
{
gpShp.AddPie(ChartExtent.X, ChartExtent.Y, ChartExtent.Width, ChartExtent.Height, StartAngle, PieAngle);
}
}
}
#endregion
#region "-- Draw Chart Shape --"
//*** Draw Column or Pie, or Line Chart
gpShp.Transform(mTransMatrix);
if (bSearch)
{
if (gpShp.IsVisible(PtX, PtY))
{
AreaId = _Shape.AreaId;
LayerId = Lyr.ID;
}
if (_Theme.ChartType == ChartType.Column)
{
gPath.AddPolygon(Pts);
}
else if (_Theme.ChartType == ChartType.Line)
{
gPath.AddRectangle(ChartExtent);
}
else if (_Theme.ChartType == ChartType.Pie)
{
gPath.AddPie(ChartExtent.X, ChartExtent.Y, ChartExtent.Width, ChartExtent.Height, StartAngle, PieAngle);
}
}
示例12: AddPie_Int
public void AddPie_Int ()
{
GraphicsPath gp = new GraphicsPath ();
gp.AddPie (1, 1, 2, 2, Pi4, Pi4);
CheckPie (gp);
}
示例13: 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;
}
}
}
示例14: Draw
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, -StartAngle, -SweepAngle );
float avgAngle = 90 - ((SweepAngle/2) + StartAngle);
RectangleF gradientrect = new RectangleF(tRect.X-10, tRect.Y-10, tRect.Width+20, tRect.Height+20);
using (LinearGradientBrush linearBrush = new LinearGradientBrush(gradientrect, RegionColorStart, RegionColorEnd, avgAngle))
{
using (Pen regionPen = new Pen(linearBrush, pane.GasGaugeRegionWidth))
{
g.DrawArc(regionPen, tRect.X, tRect.Y, tRect.Width, tRect.Height, -StartAngle, -SweepAngle);
}
}
if ( this.Border.IsVisible )
{
using (Pen borderPen = _border.GetPen(pane, scaleFactor))
{
g.DrawPie(borderPen, tRect.X, tRect.Y, tRect.Width, tRect.Height, -StartAngle, -SweepAngle);
}
}
//draw labels for the region limits
if (pane.HasLabel || HasLabel)
{
double absmax = 0;
double absmin = MinValue;
foreach (object gg in pane.CurveList)
{
if (gg is GasGaugeRegion)
{
GasGaugeRegion ggr = (GasGaugeRegion)gg;
if (absmax < ggr.MaxValue)
absmax = ggr.MaxValue;
if (absmin > ggr.MinValue)
absmin = ggr.MinValue;
}
}
DrawLabelValue(pane, (StartAngle + SweepAngle), ref m_LabelMin, MinValue);
DrawLabelValue(pane, StartAngle, ref m_LabelMax, MaxValue);
}
else
{
if (m_LabelMin != null)
m_LabelMin.IsVisible = false;
if (m_LabelMax != null)
m_LabelMax.IsVisible = false;
}
g.SmoothingMode = sMode;
}
}
}
示例15: AddPie3
private void AddPie3(Graphics g)
{
// Create a pie slice of a circle using the AddPie method.
GraphicsPath myPath = new GraphicsPath();
myPath.AddPie(new Rectangle(20, 20, 70, 70), -45, 90);
// Draw the path to the screen.
Pen myPen = new Pen(Color.Black, 2);
g.DrawPath(myPen, myPath);
}