本文整理汇总了C#中Graphics.FillPie方法的典型用法代码示例。如果您正苦于以下问题:C# Graphics.FillPie方法的具体用法?C# Graphics.FillPie怎么用?C# Graphics.FillPie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graphics
的用法示例。
在下文中一共展示了Graphics.FillPie方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw3DPieChart
// Draws a 3D pie chart where ever slice is 45 degrees in value
void Draw3DPieChart(ref Graphics objGraphics)
{
// Create location and size of ellipse.
int x = 60;
int y = 20;
int width = 200;
int height = 100;
// Create start.
float startAngle = 0;
SolidBrush objBrush = new SolidBrush(Color.Aqua);
objGraphics.SmoothingMode = SmoothingMode.AntiAlias;
Color[] color_rgb = {Color.FromArgb(20,120,255), Color.FromArgb(255,0,0),
Color.FromArgb(100,100,100), Color.FromArgb(0,255,0),
Color.FromArgb(0,255,192), Color.FromArgb(192,192,0),
Color.FromArgb(100,0,192), Color.FromArgb(0,0,255)};
for (int iLoop = 0; iLoop < 15; iLoop++)
{
startAngle = 0;
for (int i = 0; i < nMax; i++)
{
objBrush.Color = color_rgb[i];
if (iLoop == 14)
objGraphics.FillPie(objBrush, x,
y - iLoop + 25, width, height, startAngle, Angle[i]);
else
objGraphics.FillPie(new HatchBrush(HatchStyle.Percent50,
color_rgb[i]), x,
y - iLoop + 25, width, height, startAngle, Angle[i]);
startAngle += Angle[i];
}
}
for (int i = 0; i < nMax; i++)
{
objBrush.Color = color_rgb[i];
objGraphics.FillRectangle(objBrush, x + width + 80, y + i * 18, 14, 14);
objGraphics.DrawString(productName[i], new Font("Courier New", 11), new SolidBrush(Color.FromArgb(0, 0, 0)),
x + width + 100, y + i * 18);
objGraphics.DrawString(productPercent[i] + "%", new Font("Courier New", 11), new SolidBrush(Color.FromArgb(0, 0, 0)),
x + width + 20, y + i * 18);
objGraphics.DrawString(productCount[i], new Font("Courier New", 10), new SolidBrush(Color.FromArgb(0, 0, 0)),
x + width + 310, y + i * 18);
}
}
示例2: FillRoundedRectangle
public static void FillRoundedRectangle(Graphics g, Rectangle r, int d, Brush b)
{
// anti alias distorts fill so remove it.
System.Drawing.Drawing2D.SmoothingMode mode = g.SmoothingMode;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed;
g.FillPie(b, r.X, r.Y, d, d, 180, 90);
g.FillPie(b, r.X + r.Width - d, r.Y, d, d, 270, 90);
g.FillPie(b, r.X, r.Y + r.Height - d, d, d, 90, 90);
g.FillPie(b, r.X + r.Width - d, r.Y + r.Height - d, d, d, 0, 90);
g.FillRectangle(b, r.X + d / 2, r.Y, r.Width - d, d / 2);
g.FillRectangle(b, r.X, r.Y + d / 2, r.Width, r.Height - d);
g.FillRectangle(b, r.X + d / 2, r.Y + r.Height - d / 2, r.Width - d, d / 2);
g.SmoothingMode = mode;
}
示例3: FillRoundRect
public static void FillRoundRect(Graphics G, Rectangle R, int Curve, Color C)
{
using (SolidBrush B = new SolidBrush(C))
{
G.FillPie(B, R.X, R.Y, Curve, Curve, 180, 90);
G.FillPie(B, R.X + R.Width - Curve, R.Y, Curve, Curve, 270, 90);
G.FillPie(B, R.X, R.Y + R.Height - Curve, Curve, Curve, 90, 90);
G.FillPie(B, R.X + R.Width - Curve, R.Y + R.Height - Curve, Curve, Curve, 0, 90);
G.FillRectangle(B, Convert.ToInt32(R.X + Curve / 2), R.Y, R.Width - Curve, Convert.ToInt32(Curve / 2));
G.FillRectangle(B, R.X, Convert.ToInt32(R.Y + Curve / 2), R.Width, R.Height - Curve);
G.FillRectangle(B, Convert.ToInt32(R.X + Curve / 2), Convert.ToInt32(R.Y + R.Height - Curve / 2), R.Width - Curve, Convert.ToInt32(Curve / 2));
}
}
示例4: FillRoundRect
public static void FillRoundRect(Graphics G, Rectangle R, int Curve, Brush B)
{
G.FillPie(B, R.X, R.Y, Curve, Curve, 180, 90);
checked
{
G.FillPie(B, R.X + R.Width - Curve, R.Y, Curve, Curve, 270, 90);
G.FillPie(B, R.X, R.Y + R.Height - Curve, Curve, Curve, 90, 90);
G.FillPie(B, R.X + R.Width - Curve, R.Y + R.Height - Curve, Curve, Curve, 0, 90);
G.FillRectangle(B, (int)Math.Round(unchecked((double)R.X + (double)Curve / 2.0)), R.Y, R.Width - Curve, (int)Math.Round((double)Curve / 2.0));
G.FillRectangle(B, R.X, (int)Math.Round(unchecked((double)R.Y + (double)Curve / 2.0)), R.Width, R.Height - Curve);
G.FillRectangle(B, (int)Math.Round(unchecked((double)R.X + (double)Curve / 2.0)), (int)Math.Round(unchecked((double)(checked(R.Y + R.Height)) - (double)Curve / 2.0)), R.Width - Curve, (int)Math.Round((double)Curve / 2.0));
}
}
示例5: Draw3DPieChart
void Draw3DPieChart(ref Graphics objGraphics)
{
int iLoop, iLoop2=0;
// Create location and size of ellipse.
int x = 50;
int y = 20;
int width = 200;
int height = 100;
// Create start and sweep angles.
int startAngle = 0;
int sweepAngle = 45;
SolidBrush objBrush = new SolidBrush(Color.Aqua);
Random rand = new Random();
objGraphics.SmoothingMode = SmoothingMode.AntiAlias;
//Loop through 180 back around to 135 degress so it gets drawn
// correctly.
for (iLoop = 0; iLoop <= 315; iLoop += 45)
{
startAngle = (iLoop + 180) % 360;
objBrush.Color = Color.FromArgb(rand.Next(255), rand.Next(255),
rand.Next(255));
// On degrees from 0 to 180 draw 10 Hatched brush slices to show
// depth
if ((startAngle < 135) || (startAngle == 180))
{
for (iLoop2 = 0; iLoop2 < 10; iLoop2++)
objGraphics.FillPie(new HatchBrush(HatchStyle.Percent50,
objBrush.Color), x,
y + iLoop2, width, height, startAngle, sweepAngle);
}
// Displace this pie slice from pie.
if (startAngle == 135)
{
// Show Depth
objGraphics.FillPie(new HatchBrush(HatchStyle.Percent50, objBrush.Color), x - 30, y + iLoop2 + 15, width, height, startAngle, sweepAngle);
objGraphics.FillPie(objBrush, x - 30, y + 15, width, height, startAngle, sweepAngle);
}
else // Draw normally
objGraphics.FillPie(objBrush, x, y, width,
height, startAngle, sweepAngle);
}
}
示例6: Fill
// Fill this path object.
public override void Fill(Graphics graphics, Brush brush,
Pen penBrush, FillMode fillMode)
{
// TODO brubbel: calculate points and fill polygon
graphics.FillPie(brush, x, y, width, height,
startAngle, sweepAngle);
}
示例7: AddPieSlice
/// <summary>
/// call this to add a slice to the pie chart
/// </summary>
/// <param name="b"></param>
/// <param name="g"></param>
/// <param name="startAngle"></param>
/// <param name="sweepAngle"></param>
/// <returns>the new start angle</returns>
private Int16 AddPieSlice(Brush b, ref Graphics g, short startAngle, short sweepAngle)
{
g.FillPie(b, 0, 0, _maxWidth, _maxHeight, startAngle, sweepAngle);
return (Int16)(startAngle + sweepAngle);
}