本文整理汇总了C#中IGraphics.FillPie方法的典型用法代码示例。如果您正苦于以下问题:C# IGraphics.FillPie方法的具体用法?C# IGraphics.FillPie怎么用?C# IGraphics.FillPie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGraphics
的用法示例。
在下文中一共展示了IGraphics.FillPie方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
//.........这里部分代码省略.........
new Point(130, 390),
new Point(190, 400),
new Point(195, 410),
new Point(100, 430),
new Point(160, 450)
};
ig.FillClosedCurve(new SolidBrush(Color.Red), fcc, FillMode.Winding, 1f);
ig.FillClosedCurve(new SolidBrush(Color.Aquamarine), fcc, FillMode.Alternate, .2f);
}
else if (s == "Transparency")
{
Point[] fillpoly = new Point[]
{
new Point(20, 130),
new Point(60, 90),
new Point(30, 20),
new Point(80, 20),
new Point(15, 90),
new Point(100, 50),
new Point(0, 50)
};
Color col = Color.FromArgb(96,255,0,0);
ig.FillEllipse(new SolidBrush(Color.Ivory), 60, 140, 60, 30);
ig.FillPolygon(new SolidBrush(Color.Ivory), fillpoly, FillMode.Winding);
ig.TranslateTransform(10,10);
ig.FillEllipse(new SolidBrush(col), 60, 140, 60, 30);
ig.FillPolygon(new SolidBrush(col), fillpoly, FillMode.Alternate);
ig.ResetTransform();
ig.FillPie(new SolidBrush(Color.FromArgb(100,255,0,0)), 10, 200, 200, 80, 315, 90);
ig.FillPie(new SolidBrush(Color.FromArgb(100,128,128,0)), 10, 200, 200, 80, 250, -90);
ig.FillPie(new SolidBrush(Color.FromArgb(100,128,0,128)), 15, 205, 190, 70, 180, 270);
ig.FillPie(new SolidBrush(Color.FromArgb(100,200,60,60)), 20, 210, 180, 60, 45, -270);
}
else if (s == "Fills")
{
LinearGradientBrush gbr1 = new LinearGradientBrush(new Point(0,0), new Point(30,20), Color.Blue, Color.Plum);
ColorBlend blend = new ColorBlend(3);
blend.Colors = new Color[] {Color.Red, Color.Yellow, Color.MediumSlateBlue};
blend.Positions = new float[] {0, .3f, 1f};
gbr1.InterpolationColors = blend;
Point[] sp = new Point[]
{
new Point(145, 145),
new Point(305, 250),
new Point(220, 250),
new Point(180, 250)
};
ig.FillPolygon(gbr1, sp);
LinearGradientBrush gbr2 = new LinearGradientBrush(new Point(0,0), new Point(10,20), Color.WhiteSmoke, Color.CornflowerBlue);
gbr2.WrapMode = WrapMode.TileFlipXY;
Point[] sp2 = new Point[]
{
new Point(25, 205),
new Point(75, 150),
new Point(110, 110),
new Point(40, 80)
示例2: 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( IGraphics 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;
}
}
}
示例3: Draw
void Draw(IGraphics g, DrawingMode mode)
{
g.SmoothingMode = checkBoxAntialiasing.Checked ? SmoothingMode.HighQuality : SmoothingMode.None;
g.Clear(Color.White);
DrawMillimeterGridInPixels(g, tabControl1.SelectedTab.Controls[0].ClientRectangle);
g.PageUnit = GraphicsUnit.Millimeter;
var points = _noisePoints;
DrawLines(g, points, mode);
g.ResetTransform();
var path = CreateRoundedRectanglePath(new RectangleF(10, 10, 100, 40), 10);
g.FillPath(new SolidBrush(Color.FromArgb(120, Color.LightSlateGray)), path);
g.DrawPath(new Pen(Color.LightSlateGray, 0.0f), path);
g.FillPie(new SolidBrush(Color.FromArgb(120, Color.CadetBlue)), new Rectangle(30, 20, 100, 100), 45.0f, 90.0f);
g.DrawPie(new Pen(Color.CadetBlue, 0.0f), new Rectangle(30, 20, 100, 100), 45.0f, 90.0f);
//GLGraphics gl = g as GLGraphics;
//if (gl != null)
// gl.FillTextBackground = gl.FillTextBackground_glReadPixels;
g.PageUnit = GraphicsUnit.Pixel;
RectangleF rect = new RectangleF(30.0f, 15.0f, _testImage.Width, _testImage.Height);
g.DrawImage(_testImage, rect);
g.DrawRectangle(Pens.Black, rect.X, rect.Y, rect.Width, rect.Height);
g.PageUnit = GraphicsUnit.Millimeter;
g.HintTextBackgroundAction((gdi, textLocation, textRect) =>
{
_millimeterGridBrush.ResetTransform();
_millimeterGridBrush.TranslateTransform(-textLocation.X, -textLocation.Y);
gdi.FillRectangle(_millimeterGridBrush, textRect);
});
g.DrawString("Testovací řetězec pro odzkoušení správné implementace IGraphics - metody DrawString.",
new Font("Arial", 12.0f), Brushes.Black, new PointF(100.0f, 58.0f));
}
示例4: Draw
/// <summary>
/// Do all rendering associated with this <see cref="GasGaugeNeedle"/> 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">Not used for rendering GasGaugeNeedle</param>
public override void Draw( IGraphics 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;
Matrix matrix = new Matrix();
matrix.Translate( tRect.X + ( tRect.Width / 2 ), tRect.Y + ( tRect.Height / 2 ), MatrixOrder.Prepend );
PointF[] pts = new PointF[2];
pts[0] = new PointF( ( ( tRect.Height * .10f ) / 2.0f ) * (float)Math.Cos( -SweepAngle * Math.PI / 180.0f ),
( ( tRect.Height * .10f ) / 2.0f ) * (float)Math.Sin( -SweepAngle * Math.PI / 180.0f ) );
pts[1] = new PointF( ( tRect.Width / 2.0f ) * (float)Math.Cos( -SweepAngle * Math.PI / 180.0f ),
( tRect.Width / 2.0f ) * (float)Math.Sin( -SweepAngle * Math.PI / 180.0f ) );
matrix.TransformPoints( pts );
Pen p = new Pen( NeedleColor, ( ( tRect.Height * .10f ) / 2.0f ) );
p.EndCap = LineCap.ArrowAnchor;
g.DrawLine( p, pts[0].X, pts[0].Y, pts[1].X, pts[1].Y );
//Fill center 10% with Black dot;
Fill f = new Fill( Color.Black );
RectangleF r = new RectangleF( ( tRect.X + ( tRect.Width / 2 ) ) - 1.0f, ( tRect.Y + ( tRect.Height / 2 ) ) - 1.0f, 1.0f, 1.0f );
r.Inflate( ( tRect.Height * .10f ), ( tRect.Height * .10f ) );
Brush b = f.MakeBrush( r );
g.FillPie( b, r.X, r.Y, r.Width, r.Height, 0.0f, -180.0f );
Pen borderPen = new Pen( Color.White, 2.0f );
g.DrawPie( borderPen, r.X, r.Y, r.Width, r.Height, 0.0f, -180.0f );
g.SmoothingMode = sMode;
}
}
}