本文整理匯總了C#中System.Drawing.Graphics.FillPie方法的典型用法代碼示例。如果您正苦於以下問題:C# Graphics.FillPie方法的具體用法?C# Graphics.FillPie怎麽用?C# Graphics.FillPie使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Drawing.Graphics
的用法示例。
在下文中一共展示了Graphics.FillPie方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Draw
public void Draw(Graphics g)
{
if (isOpen)
{
g.FillEllipse(brush, X * 2 * RADIUS, Y * 2 * RADIUS, RADIUS * 2, RADIUS * 2);
}
else
{
if (Direction == DIRECTION.RIGHT)
{
g.FillPie(brush, X * 2 * RADIUS, Y * 2 * RADIUS, RADIUS * 2, RADIUS * 2, 45, 270);
}
else if (Direction == DIRECTION.LEFT)
{
g.FillPie(brush, X * 2 * RADIUS, Y * 2 * RADIUS, RADIUS * 2, RADIUS * 2, 225, 270);
}
else if (Direction == DIRECTION.UP)
{
g.FillPie(brush, X * 2 * RADIUS, Y * 2 * RADIUS, RADIUS * 2, RADIUS * 2, 315, 270);
}
else
{
g.FillPie(brush, X * 2 * RADIUS, Y * 2 * RADIUS, RADIUS * 2, RADIUS * 2, 135, 270);
}
}
}
示例2: Draw
public override void Draw(RectangleF rect)
{
Graphics g = new Graphics();
//g.Clear(Color.White);
// Create a pen object:
Pen aPen = new Pen(Color.Blue, 1 / g.DpiX);
// Create a brush object with a transparent red color:
SolidBrush aBrush = new SolidBrush(Color.Red);
g.PageUnit = GraphicsUnit.Inch;
g.PageScale = 2;
g.RenderingOrigin = new PointF(0.5f,0.0f);
// Draw a rectangle:
g.DrawRectangle(aPen, .20f, .20f, 1.00f, .50f);
// Draw a filled rectangle:
g.FillRectangle(aBrush, .20f, .90f, 1.00f, .50f);
// Draw ellipse:
g.DrawEllipse(aPen, new RectangleF(.20f, 1.60f, 1.00f, .50f));
// Draw filled ellipse:
g.FillEllipse(aBrush, new RectangleF(1.70f, .20f, 1.00f, .50f));
// Draw arc:
g.DrawArc(aPen, new RectangleF(1.70f, .90f, 1.00f, .50f), -90, 180);
// Draw filled pie pieces
g.FillPie(aBrush, 1.70f, 1.60f, 1.00f, 1.00f, -90, 90);
g.FillPie(Brushes.Green, 1.70f, 1.60f, 1.00f, 1.00f, -90, -90);
g.Dispose();
}
示例3: DrawRect
public override void DrawRect(System.Drawing.RectangleF dirtyRect)
{
Graphics g = new Graphics();
g.Clear(Color.White);
g.SmoothingMode = SmoothingMode.AntiAlias;
// Create a pen object:
Pen aPen = new Pen(Color.Blue, 2);
// Create a brush object with a transparent red color:
SolidBrush aBrush = new SolidBrush(Color.Red);
HatchBrush hBrush = new HatchBrush(HatchStyle.Shingle, Color.Blue, Color.LightCoral);
HatchBrush hBrush2 = new HatchBrush(HatchStyle.Cross, Color.Blue, Color.LightCoral);
HatchBrush hBrush3 = new HatchBrush(HatchStyle.BackwardDiagonal, Color.Blue, Color.LightCoral);
HatchBrush hBrush4 = new HatchBrush(HatchStyle.Sphere, Color.Blue, Color.LightCoral);
// Draw a rectangle:
g.DrawRectangle(aPen, 20, 20, 100, 50);
// Draw a filled rectangle:
g.FillRectangle(hBrush, 20, 90, 100, 50);
// Draw ellipse:
g.DrawEllipse(aPen, new Rectangle(20, 160, 100, 50));
// Draw filled ellipse:
g.FillEllipse(hBrush2, new Rectangle(170, 20, 100, 50));
// Draw arc:
g.DrawArc(aPen, new Rectangle(170, 90, 100, 50), -90, 180);
// Draw filled pie pieces
g.FillPie(aBrush, new Rectangle(170, 160, 100, 100), -90, 90);
g.FillPie(hBrush4, new Rectangle(170, 160, 100, 100), -90, -90);
// Create pens.
Pen redPen = new Pen(Color.Red, 3);
Pen greenPen = new Pen(Color.Green, 3);
greenPen.DashStyle = DashStyle.DashDotDot;
SolidBrush transparentBrush = new SolidBrush(Color.FromArgb(150, Color.Wheat));
// define point array to draw a curve:
Point point1 = new Point(300, 250);
Point point2 = new Point(350, 125);
Point point3 = new Point(400, 110);
Point point4 = new Point(450, 210);
Point point5 = new Point(500, 300);
Point[] curvePoints ={ point1, point2, point3, point4, point5};
// Draw lines between original points to screen.
g.DrawLines(redPen, curvePoints);
// Fill Curve
g.FillClosedCurve(transparentBrush, curvePoints);
// Draw closed curve to screen.
g.DrawClosedCurve(greenPen, curvePoints);
g.Dispose();
}
示例4: FillRoundedRectangle
public static void FillRoundedRectangle(Graphics g, Rectangle r, int d, Brush b)
{
SmoothingMode mode = g.SmoothingMode;
g.SmoothingMode = 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;
}
示例5: RepertoryImage
public static void RepertoryImage(Graphics drawDestination)
{
if (mMscStyle==MscStyle.UML2){
StringFormat itemStringFormat = new StringFormat();
RectangleF itemBox = new RectangleF(5, 20, 30, 15);
itemStringFormat.Alignment = StringAlignment.Near;
itemStringFormat.LineAlignment = StringAlignment.Near;
PointF[] statePolygon = new PointF[5];
statePolygon[0] = new PointF(5,20);
statePolygon[1] = new PointF(40,20);
statePolygon[2] = new PointF(40,30);
statePolygon[3] = new PointF(35,35);
statePolygon[4] = new PointF(5,35);
drawDestination.FillRectangle(Brushes.White,5,20,70,40);
drawDestination.DrawString("ref",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
drawDestination.DrawPolygon(Pens.Black,statePolygon);
itemBox = new RectangleF(5, 30, 70, 30);
itemStringFormat.Alignment = StringAlignment.Center;
itemStringFormat.LineAlignment = StringAlignment.Center;
drawDestination.DrawString("Reference",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
drawDestination.DrawRectangle(Pens.Black,5,20,70,40);
itemStringFormat.Dispose();
}
else if (mMscStyle==MscStyle.SDL){
StringFormat itemStringFormat = new StringFormat();
RectangleF itemBox = new RectangleF(10, 25, 60, 30);
itemStringFormat.Alignment = StringAlignment.Center;
itemStringFormat.LineAlignment = StringAlignment.Center;
drawDestination.FillPie(Brushes.White,5,20,10,10,180,90);
drawDestination.FillPie(Brushes.White,5,50,10,10,90,90);
drawDestination.FillPie(Brushes.White,65,20,10,10,270,90);
drawDestination.FillPie(Brushes.White,65,50,10,10,0,90);
drawDestination.FillRectangle(Brushes.White, 5, 25, 5, 30);
drawDestination.FillRectangle(Brushes.White, 70, 25, 5, 30);
drawDestination.FillRectangle(Brushes.White, 10, 20, 60, 40);
drawDestination.DrawLine(Pens.Black,10,20,70,20);
drawDestination.DrawLine(Pens.Black,5,25,5,55);
drawDestination.DrawLine(Pens.Black,10,60,70,60);
drawDestination.DrawLine(Pens.Black,75,25,75,55);
drawDestination.DrawArc(Pens.Black,5,20,10,10,180,90);
drawDestination.DrawArc(Pens.Black,5,50,10,10,90,90);
drawDestination.DrawArc(Pens.Black,65,20,10,10,270,90);
drawDestination.DrawArc(Pens.Black,65,50,10,10,0,90);
drawDestination.DrawString("Reference",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
}
}
示例6: DrawSign
//##################################################################################
public virtual void DrawSign(Graphics g, Font font, string sign, int x, int y)
{
var boxSize = TextRenderer.MeasureText(sign, font);
int boxWidth = boxSize.Width + 4;
int boxHeight = boxSize.Height + 8;
g.FillPie(Brushes.SandyBrown,
x - 16,
y - 14,
32,
28,
270 - 20,
40);
g.FillRectangle(Brushes.SandyBrown,
x - boxWidth / 2,
y - boxHeight - 8,
boxWidth,
boxHeight);
g.DrawString(sign, font, Brushes.Black,
x,
y - boxHeight - 4,
new StringFormat()
{
Alignment = StringAlignment.Center
});
}
示例7: OnRender
public override void OnRender(Graphics g)
{
base.OnRender(g);
if (wprad == 0 || Overlay.Control == null)
return;
// if we have drawn it, then keep that color
if (!initcolor.HasValue)
Color = Color.White;
//wprad = 300;
// undo autochange in mouse over
//if (Pen.Color == Color.Blue)
// Pen.Color = Color.White;
double width = (Overlay.Control.MapProvider.Projection.GetDistance(Overlay.Control.FromLocalToLatLng(0, 0), Overlay.Control.FromLocalToLatLng(Overlay.Control.Width, 0)) * 1000.0);
double height = (Overlay.Control.MapProvider.Projection.GetDistance(Overlay.Control.FromLocalToLatLng(0, 0), Overlay.Control.FromLocalToLatLng(Overlay.Control.Height, 0)) * 1000.0);
double m2pixelwidth = Overlay.Control.Width / width;
double m2pixelheight = Overlay.Control.Height / height;
GPoint loc = new GPoint((int)(LocalPosition.X - (m2pixelwidth * wprad * 2)), LocalPosition.Y);// MainMap.FromLatLngToLocal(wpradposition);
//if (m2pixelheight > 0.5)
g.DrawArc(Pen, new System.Drawing.Rectangle(LocalPosition.X - Offset.X - (int)(Math.Abs(loc.X - LocalPosition.X) / 2), LocalPosition.Y - Offset.Y - (int)Math.Abs(loc.X - LocalPosition.X) / 2, (int)Math.Abs(loc.X - LocalPosition.X), (int)Math.Abs(loc.X - LocalPosition.X)), 0, 360);
g.FillPie(new SolidBrush(Color.FromArgb(25,Color.Red)), LocalPosition.X - Offset.X - (int)(Math.Abs(loc.X - LocalPosition.X) / 2), LocalPosition.Y - Offset.Y - (int)Math.Abs(loc.X - LocalPosition.X) / 2, Math.Abs(loc.X - LocalPosition.X), Math.Abs(loc.X - LocalPosition.X), 0, 360);
}
示例8: Draw
public override void Draw(Graphics g, Tank t)
{
double ang1 = t.orientation + angleWithBase - viewAngle / 2;
double ang2 = t.orientation + angleWithBase + viewAngle / 2;
g.FillPie(new SolidBrush(Color.FromArgb(drawAlpha, color))
, (int)t.pos.X - maxViewDistance, (int)t.pos.Y - maxViewDistance
, 2 * maxViewDistance, 2 * maxViewDistance, (int)ang1, (int)ang2);
}
示例9: onManagedDraw
public void onManagedDraw(Graphics graphics)
{
float angle;
if (this.shotCount < this.ShotCount) {
angle = this.secondsElapsed >= this.ShotTime ? 360 : 360 * this.secondsElapsed / this.ShotTime;
graphics.FillPie (Brushes.Silver, Options.CameraWidth / 2 - 100, 0, 200, 200, 0, angle);
} else {
if (this.RechargeTime != 0) {
angle = 360 * this.secondsElapsed / this.RechargeTime;
graphics.FillPie (Brushes.Black, Options.CameraWidth / 2 - 100, 0, 200, 200, 0, angle);
}
}
graphics.DrawEllipse (Pens.Black, Options.CameraWidth / 2 - 100, 0, 200, 200);
for (int i = 0; i < this.bullets.Count; ++i) {
this.bullets [i].onManagedDraw (graphics);
}
}
示例10: Draw
public override void Draw(Graphics g, Rectangle r, Brush bg, Brush fg, uint seed, bool fliphorizontal)
{
switch ((seed + (fliphorizontal ? 2 : 0)) % 4)
{
case 0: // ◞
g.FillPie(fg, new Rectangle(r.Left - r.Width, r.Top - r.Height, r.Width * 2, r.Height * 2), 0, 90);
break;
case 1: // ◜
g.FillPie(fg, new Rectangle(r.Left, r.Top, r.Width * 2, r.Height * 2), -90, -90);
break;
case 2: // ◟
g.FillPie(fg, new Rectangle(r.Left, r.Top - r.Height, r.Width * 2, r.Height * 2), 90, 90);
break;
case 3: // ◝
default:
g.FillPie(fg, new Rectangle(r.Left - r.Width, r.Top, r.Width * 2, r.Height * 2), 0, -90);
break;
}
}
示例11: Draw
public override void Draw(Graphics g)
{
Pen pen = new Pen(Brushes.Black,3);
UpdateBounds();
g.FillEllipse(Brushes.Red, X,Y, 10, 10);
g.DrawEllipse(pen, X - 3, Y - 3, 13, 13);
g.FillPie(Brushes.White,X,Y, 10, 10, 0, 180);
g.DrawEllipse(pen, X + 3, Y + 3, 2, 2);
Y = Y - BallInterval;
}
示例12: Render
public void Render(Graphics graphics)
{
graphics.FillPie(
_brush,
_rectangle.X,
_rectangle.Y,
_rectangle.Width,
_rectangle.Height,
_startAngle,
_endAngle);
}
示例13: DrawOn
public void DrawOn(Graphics graphics)
{
if (_flag == true)
{
graphics.FillPie(_brush, _center.X - _radius, _center.Y - _radius, _diameter, _diameter, _floatStartAngle,
_floatArcAngle);
}
else
{
graphics.DrawArc(_pen, _center.X - _radius, _center.Y - _radius, _diameter, _diameter, 0, 360);
}
}
示例14: DrawGlowCorner
private void DrawGlowCorner(Graphics g)
{
using (var graphicsPath = new GraphicsPath())
using (var graphicsPath2 = new GraphicsPath())
{
var rect = new Rectangle(-GlowSize, -1, GlowSize * 2, GlowSize * 2);
var rect2 = new Rectangle(-GlowSize, Owner.Height, GlowSize * 2, GlowSize * 2);
graphicsPath.AddEllipse(rect);
graphicsPath2.AddEllipse(rect2);
using (var pathGradientBrush = new PathGradientBrush(graphicsPath))
using (var pathGradientBrush2 = new PathGradientBrush(graphicsPath2))
{
pathGradientBrush.CenterColor = GlowAlphaColor;
pathGradientBrush.SurroundColors = new[] { Color.Transparent, Color.Transparent, Color.Transparent, Color.Transparent };
pathGradientBrush2.CenterColor = GlowAlphaColor;
pathGradientBrush2.SurroundColors = new[] { Color.Transparent, Color.Transparent, Color.Transparent, Color.Transparent };
g.FillPie(pathGradientBrush, rect, 270, 90);
g.FillPie(pathGradientBrush2, rect2, 0, 90);
}
}
}
示例15: 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;
}