本文整理汇总了C#中System.Drawing.Graphics.DrawBeziers方法的典型用法代码示例。如果您正苦于以下问题:C# Graphics.DrawBeziers方法的具体用法?C# Graphics.DrawBeziers怎么用?C# Graphics.DrawBeziers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Graphics
的用法示例。
在下文中一共展示了Graphics.DrawBeziers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawBeziersPointF
private void DrawBeziersPointF(PaintEventArgs e)
{
// Create pen.
Pen blackPen = new Pen(Color.Black, 3);
// Create points for curve.
PointF start = new PointF(100.0F, 100.0F);
PointF control1 = new PointF(200.0F, 10.0F);
PointF control2 = new PointF(350.0F, 50.0F);
PointF end1 = new PointF(500.0F, 100.0F);
PointF control3 = new PointF(600.0F, 150.0F);
PointF control4 = new PointF(650.0F, 250.0F);
PointF end2 = new PointF(500.0F, 300.0F);
PointF[] bezierPoints = { start, control1, control2, end1,
control3, control4, end2 };
// Draw arc to screen.
e.Graphics.DrawBeziers(blackPen, bezierPoints);
}
示例2: DrawBeziersPoint
private void DrawBeziersPoint(PaintEventArgs e)
{
// Create pen.
Pen blackPen = new Pen(Color.Black, 3);
// Create points for curve.
Point start = new Point(100, 100);
Point control1 = new Point(200, 10);
Point control2 = new Point(350, 50);
Point end1 = new Point(500, 100);
Point control3 = new Point(600, 150);
Point control4 = new Point(650, 250);
Point end2 = new Point(500, 300);
Point[] bezierPoints =
{
start, control1, control2, end1,
control3, control4, end2
};
// Draw arc to screen.
e.Graphics.DrawBeziers(blackPen, bezierPoints);
}
示例3: Main
//引入命名空间
using System;
using System.Drawing;
using System.Windows.Forms;
class BezierArt: Form
{
public static void Main()
{
Application.Run(new BezierArt());
}
public BezierArt()
{
ResizeRedraw = true;
}
protected override void OnPaint(PaintEventArgs pea)
{
DoPage(pea.Graphics, ForeColor,200, 200);
}
protected void DoPage(Graphics grfx, Color clr, int cx, int cy)
{
Pen pen = new Pen(clr);
PointF[] aptf = new PointF[4];
int iNum = 100;
for (int i = 0; i < iNum; i++)
{
double dAngle = 2 * i * Math.PI / iNum;
aptf[0].X = cx / 2 + cx / 2 * (float) Math.Cos(dAngle);
aptf[0].Y = 5 * cy / 8 + cy / 16 * (float) Math.Sin(dAngle);
aptf[1] = new PointF(cx / 2, -cy);
aptf[2] = new PointF(cx / 2, 2 * cy);
dAngle += Math.PI;
aptf[3].X = cx / 2 + cx / 4 * (float) Math.Cos(dAngle);
aptf[3].Y = cy / 2 + cy / 16 * (float) Math.Sin(dAngle);
grfx.DrawBeziers(pen, aptf);
}
}
}