本文整理汇总了C#中Graphics.DrawArc方法的典型用法代码示例。如果您正苦于以下问题:C# Graphics.DrawArc方法的具体用法?C# Graphics.DrawArc怎么用?C# Graphics.DrawArc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graphics
的用法示例。
在下文中一共展示了Graphics.DrawArc方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawRoundRect
public static void DrawRoundRect(Graphics G, Rectangle R, int Curve, Color C)
{
using (Pen P = new Pen(C))
{
G.DrawArc(P, R.X, R.Y, Curve, Curve, 180, 90);
G.DrawLine(P, Convert.ToInt32(R.X + Curve / 2), R.Y, Convert.ToInt32(R.X + R.Width - Curve / 2), R.Y);
G.DrawArc(P, R.X + R.Width - Curve, R.Y, Curve, Curve, 270, 90);
G.DrawLine(P, R.X, Convert.ToInt32(R.Y + Curve / 2), R.X, Convert.ToInt32(R.Y + R.Height - Curve / 2));
G.DrawLine(P, Convert.ToInt32(R.X + R.Width), Convert.ToInt32(R.Y + Curve / 2), Convert.ToInt32(R.X + R.Width), Convert.ToInt32(R.Y + R.Height - Curve / 2));
G.DrawLine(P, Convert.ToInt32(R.X + Curve / 2), Convert.ToInt32(R.Y + R.Height), Convert.ToInt32(R.X + R.Width - Curve / 2), Convert.ToInt32(R.Y + R.Height));
G.DrawArc(P, R.X, R.Y + R.Height - Curve, Curve, Curve, 90, 90);
G.DrawArc(P, R.X + R.Width - Curve, R.Y + R.Height - Curve, Curve, Curve, 0, 90);
}
}
示例2: Run
public static void Run()
{
// ExStart:DrawingBezier
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_DrawingAndFormattingImages();
// Creates an instance of FileStream
using (FileStream stream = new FileStream(dataDir + "DrawingArc_out.bmp", FileMode.Create))
{
// Create an instance of BmpOptions and set its various properties
BmpOptions saveOptions = new BmpOptions();
saveOptions.BitsPerPixel = 32;
// Set the Source for BmpOptions and create an instance of Image
saveOptions.Source = new StreamSource(stream);
using (Image image = Image.Create(saveOptions, 100, 100))
{
// Create and initialize an instance of Graphics class and clear Graphics surface
Graphics graphic = new Graphics(image);
graphic.Clear(Color.Yellow);
// Draw an arc shape by specifying the Pen object having red black color and coordinates, height, width, start & end angles
int width = 100;
int height = 200;
int startAngle = 45;
int sweepAngle = 270;
// Draw arc to screen and save all changes.
graphic.DrawArc(new Pen(Color.Black), 0, 0, width, height, startAngle, sweepAngle);
image.Save();
}
stream.Close();
}
}
示例3: Fill
// Fill this path object.
public override void Fill(Graphics graphics, Brush brush,
Pen penBrush, FillMode fillMode)
{
graphics.DrawArc(penBrush, x, y, width, height, startAngle, sweepAngle);
}
示例4: DrawRoundRect
public static void DrawRoundRect(Graphics G, Rectangle R, int Curve, Pen PP)
{
G.DrawArc(PP, R.X, R.Y, Curve, Curve, 180, 90);
checked
{
G.DrawLine(PP, (int)Math.Round(unchecked((double)R.X + (double)Curve / 2.0)), R.Y, (int)Math.Round(unchecked((double)(checked(R.X + R.Width)) - (double)Curve / 2.0)), R.Y);
G.DrawArc(PP, R.X + R.Width - Curve, R.Y, Curve, Curve, 270, 90);
G.DrawLine(PP, R.X, (int)Math.Round(unchecked((double)R.Y + (double)Curve / 2.0)), R.X, (int)Math.Round(unchecked((double)(checked(R.Y + R.Height)) - (double)Curve / 2.0)));
G.DrawLine(PP, R.X + R.Width, (int)Math.Round(unchecked((double)R.Y + (double)Curve / 2.0)), R.X + R.Width, (int)Math.Round(unchecked((double)(checked(R.Y + R.Height)) - (double)Curve / 2.0)));
G.DrawLine(PP, (int)Math.Round(unchecked((double)R.X + (double)Curve / 2.0)), R.Y + R.Height, (int)Math.Round(unchecked((double)(checked(R.X + R.Width)) - (double)Curve / 2.0)), R.Y + R.Height);
G.DrawArc(PP, R.X, R.Y + R.Height - Curve, Curve, Curve, 90, 90);
G.DrawArc(PP, R.X + R.Width - Curve, R.Y + R.Height - Curve, Curve, Curve, 0, 90);
}
}
示例5: Draw
// Draw this path object.
public override void Draw(Graphics graphics, Pen pen)
{
graphics.DrawArc(pen, x, y, width, height, startAngle, sweepAngle);
//graphics.DrawLine(pen, this.startPoint, this.endPoint);
}