本文整理汇总了C#中System.Drawing.Graphics.DrawCurve方法的典型用法代码示例。如果您正苦于以下问题:C# Graphics.DrawCurve方法的具体用法?C# Graphics.DrawCurve怎么用?C# Graphics.DrawCurve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Graphics
的用法示例。
在下文中一共展示了Graphics.DrawCurve方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public void Draw(Graphics g, Player player)
{
if (ShootingPoints.Count > 0)
{
try
{
g.DrawCurve(shootingPen, ShootingPoints.ToArray());
g.TranslateTransform(1, 0);
g.DrawCurve(shootingPen1, ShootingPoints.ToArray());
g.ResetTransform();
}
catch (Exception e)
{
Console.WriteLine("Shot.cs-Draw-EXCEPTION : {0}", e.Message);
}
//STRELKA
Point lastOne = (Point)ShootingPoints[ShootingPoints.Count-1];
trianglePoints = new Point[3];
trianglePoints[0] = new Point(lastOne.X - 2, lastOne.Y - 10);
trianglePoints[1] = new Point(lastOne.X - 8, lastOne.Y + 2);
trianglePoints[2] = new Point(lastOne.X + 4, lastOne.Y + 2);
g.FillPolygon(new SolidBrush(Color.Black), trianglePoints);
trianglePoints = new Point[3];
}
}
示例2: Draw
public void Draw(Graphics g)
{
Pen borderPen = new Pen(Color.Black, this.pen.Width + 2);
if (isSelected)
{
Pen selectedBorderPen = new Pen(Color.Green, this.pen.Width + 2);
g.DrawCurve(selectedBorderPen, this.points.ToArray());
}
else g.DrawCurve(borderPen, this.points.ToArray());
g.DrawCurve(pen, this.points.ToArray());
}
示例3: Draw
public static void Draw(Graphics g, bool timer)
{
int L = 0;
if (lines[0] != null)
L = lines[0].Length;
Point[] p = new Point[L];
float x, y;
g.DrawLine(Pens.Red, II(-50), JJ(0), II(50), JJ(0));
g.DrawLine(Pens.Blue, II(0), JJ(-50), II(0), JJ(50));
if (L > 0)
{
if (!timer)
{
for (int i = 0; i < L; i++)
{
x = lines[0][i].X;
y = lines[0][i].Y;
g.DrawRectangle(Pens.Green, II(x) - 2, JJ(y) - 2, 4, 4);
p[i].X = II(x);
p[i].Y = JJ(y);
}
g.DrawCurve(Pens.Green, p);
for (int i = 0; i < L; i++)
{
x = lines[1][i].X;
y = lines[1][i].Y;
g.DrawRectangle(Pens.Orange, II(x) - 2, JJ(y) - 2, 4, 4);
p[i].X = II(x);
p[i].Y = JJ(y);
}
g.DrawCurve(Pens.Orange, p);
}
else
{
if (tmpLines != null)
{
for (int i = 0; i < L; i++)
{
x = tmpLines[i].X;
y = tmpLines[i].Y;
p[i].X = II(x);
p[i].Y = JJ(y);
}
g.DrawCurve(Pens.Black, p);
}
}
}
}
示例4: Draw
public void Draw(Graphics graphics)
{
if (_points.Count < 2) return;
graphics.TranslateTransform(_width / 2, _height / 2);
var pen = new Pen(Color.Blue, 2f) { LineJoin = LineJoin.Bevel };
graphics.DrawCurve(pen, _points.ToArray());
}
示例5: Draw
public override void Draw(Graphics gfx, Point offset)
{
gfx.TranslateTransform(offset.X, offset.Y);
if (Points.Count > 1)
gfx.DrawCurve(pen, Points.ToArray());
gfx.ResetTransform();
}
示例6: DrawLine
//划很多线
public static void DrawLine(Graphics g, List<PointF> pointList)
{
PointF[] temps = new PointF[pointList.Count];
for (int i = 0; i < pointList.Count; i++)
{
temps[i] = pointList[i];
}
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
g.DrawCurve(new Pen(Color.Red, 1), temps, 0.2F);
//g.Dispose();
}
示例7: Draw
public override void Draw(RectangleF dirtyRect)
{
Graphics g = new Graphics();
// Create a pen object:
Pen aPen = new Pen(Color.Blue, 4);
// Set line caps and dash style:
aPen.StartCap = LineCap.Flat;
aPen.EndCap = LineCap.ArrowAnchor;
aPen.DashStyle = DashStyle.Dot;
aPen.DashOffset = 50;
//g.ScaleTransform(4,4);
//draw straight line:
g.DrawLine(aPen, 50, 30, 200, 30);
// define point array to draw a curve:
Point point1 = new Point(50, 200);
Point point2 = new Point(100, 75);
Point point3 = new Point(150, 60);
Point point4 = new Point(200, 160);
Point point5 = new Point(250, 250);
Point[] Points ={ point1, point2, point3, point4, point5};
g.DrawCurve(aPen, Points);
aPen.Dispose();
//g.Dispose();
//Text rotation:
RectangleF ClientRectangle = dirtyRect;
string s = "A simple text string";
Rectangle rect = new Rectangle((int)ClientRectangle.X, (int)ClientRectangle.Y,
(int)ClientRectangle.Width, (int)ClientRectangle.Height);
drawingRectangle = new Rectangle(rect.Location, rect.Size);
Size sz = new Size(rect.Width, rect.Height);
var font = new Font("Arialss",14.0f,FontStyle.Bold | FontStyle.Italic | FontStyle.Underline);
SizeF stringSize = g.MeasureString(s, font);
Point Middle = new Point(sz.Width / 30,
sz.Height / 2 - (int)stringSize.Height / 2);
g.DrawLine(Pens.Black, new Point(0, rect.Height/2), new Point(rect.Width, rect.Height/2));
g.DrawLine(Pens.Black, new Point(rect.Width / 2, 0), new Point(rect.Width / 2, rect.Height));
g.TranslateTransform(Middle.X, Middle.Y);
g.RotateTransform (-90);
//StringFormat format = new StringFormat(StringFormatFlags.NoClip);
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Center;
//format.LineAlignment = StringAlignment.Center;
g.DrawString (s, font, Brushes.Black, 0, 0, format);
g.Dispose();
}
示例8: DrawSelectionLasso
/// <summary>
/// Draw a polyline using an array of points and fills the interior
/// cfr Lasso Select in Paint.Net
/// </summary>
/// <param name="graphics"></param>
/// <param name="color"></param>
/// <param name="points"></param>
public static void DrawSelectionLasso(Graphics graphics, Color color, PointF[] points)
{
if (points.Length < 2)
{
return;
}
Pen pen = new Pen(color);
graphics.DrawCurve(pen, points);
pen.Dispose();
Brush brush = new SolidBrush(Color.FromArgb(30, color));
graphics.FillClosedCurve(brush, points);
brush.Dispose();
}
示例9: DrawLine
protected virtual void DrawLine(Graphics g, Pen pen)
{
pen.StartCap = LineCap.Round;
pen.EndCap = LineCap.Round;
if (CenterNodeActive)
{
g.DrawCurve(pen, new Point[] { StartPosition, CenterPosition, EndPosition });
}
else
{
g.DrawLine(pen, StartPosition, EndPosition);
}
}
示例10: DrawLine
protected override void DrawLine(Graphics g, Pen pen)
{
using (AdjustableArrowCap arrowCap = new AdjustableArrowCap(4, 6))
{
pen.CustomEndCap = arrowCap;
if (CenterNodeActive)
{
g.DrawCurve(pen, new Point[] { StartPosition, CenterPosition, EndPosition });
}
else
{
g.DrawLine(pen, StartPosition, EndPosition);
}
}
}
示例11: drawCurve
void drawCurve(Graphics graphics, int a, int b)
{
Pen greenPen = new Pen(Color.Green);
double x;
double y;
double bACosI;
double twoPi = Math.PI * 2;
List<Point> points = new List<Point>();
for (double i = 0; i < twoPi; i += 0.001)
{
bACosI = b + a * Math.Cos(i);
x = bACosI * Math.Cos(i);
y = bACosI * Math.Sin(i);
points.Add(new Point((int)x + offset, (int)y + offset));
}
drawAxis(graphics);
graphics.DrawCurve(greenPen, points.ToArray());
}
示例12: Finish
protected override void Finish(Point position)
{
StartPoint = new DrawingPoint((int)(position.X / ViewModel.Zoom), (int)(position.Y / ViewModel.Zoom));
points.Add(StartPoint);
if (ViewModel.Inpainting.CreateMask)
{
maskGraphics.DrawCurve(maskPen, points.ToArray());
ViewModel.Mask = mask;
}
else
{
ViewModel.ComandList.AddNew(new Bitmap(ViewModel.Image.Source));
Bitmap bitmap = ViewModel.Image.Source;
graphics = Graphics.FromImage(bitmap);
graphics.DrawCurve(pen, points.ToArray());
ViewModel.RefreshImage();
ViewModel.OnCommandExecuted();
}
}
示例13: dessine
public void dessine(Graphics g,Point offsetPoint)
{
if (this.isEnabled == true)
{
Point[] tabPoints = new Point[this.Path.Count];
for (int i = 0; i < this.Path.Count; i++)
{
int x = this.Path[i].X + offsetPoint.X;
int y = this.Path[i].Y + offsetPoint.Y;
tabPoints[i] = new Point(x, y);
}
float[] dashValues = { 1, 1 };
Pen pen = new Pen(Color.FromArgb(150, Color.Blue), 2);
SolidBrush br = new SolidBrush(Color.FromArgb(155, Color.Green));
pen.DashPattern = dashValues;
if (tabPoints.Length > 1)
{
if (this.isCurve == true)
{
g.DrawCurve(pen, tabPoints);
}
else
{
g.DrawLines(pen, tabPoints);
}
}
for (int i = 0; i < tabPoints.Length; i++)
{
g.FillEllipse(br, new Rectangle(tabPoints[i].X - 3, tabPoints[i].Y - 3, 6, 6));
}
pen.Dispose();
br.Dispose();
}
}
示例14: Render
//Render a polygon
private static void Render(DnaPolygon polygon, Graphics g, int scale)
{
if (polygon.IsComplex)
return;
Point[] points = GetGdiPoints(polygon.Points, scale);
using (Brush brush = GetGdiBrush(polygon.Brush))
{
if (polygon.Splines)
{
if (polygon.Filled)
{
g.FillClosedCurve(brush, points, FillMode.Winding);
}
else
{
using (Pen pen = new Pen(brush, Math.Max(1, polygon.Width)))
{
g.DrawCurve(pen, points, 3F);
}
}
}
else
{
if (polygon.Filled)
{
g.FillPolygon(brush, points, FillMode.Winding);
}
else
{
using (Pen pen = new Pen(brush, Math.Max(1, polygon.Width)))
{
g.DrawPolygon(pen, points);
}
}
}
}
}
示例15: AddLines
public void AddLines(Graphics g, ChartStyle cs)
{
// Plot lines:
foreach (DataSeries ds in DataSeriesList) {
if (ds.LineStyle.IsVisible == true) {
var aPen = new Pen (ds.LineStyle.LineColor, ds.LineStyle.Thickness);
aPen.DashStyle = ds.LineStyle.Pattern;
if (ds.LineStyle.PlotMethod == LineStyle.PlotLinesMethodEnum.Lines) {
for (int i = 1; i < ds.PointList.Count; i++) {
g.DrawLine (aPen, cs.Point2D ((CGPoint)ds.PointList[i - 1]), cs.Point2D ((CGPoint)ds.PointList[i]));
}
} else if (ds.LineStyle.PlotMethod == LineStyle.PlotLinesMethodEnum.Splines) {
var al = new ArrayList ();
for (int i = 0; i < ds.PointList.Count; i++) {
var pt = (CGPoint)ds.PointList[i];
if (pt.X >= cs.XLimMin && pt.X <= cs.XLimMax && pt.Y >= cs.YLimMin && pt.Y <= cs.YLimMax)
al.Add (pt);
}
var pts = new PointF[al.Count];
for (int i = 0; i < pts.Length; i++)
pts[i] = cs.Point2D ((CGPoint)(al[i]));
g.DrawCurve (aPen, pts);
}
aPen.Dispose();
}
}
foreach (DataSeries ds in DataSeriesList) {
for (int i = 0; i < ds.PointList.Count; i++) {
var pt = (CGPoint)ds.PointList[i];
if (pt.X >= cs.XLimMin && pt.X <= cs.XLimMax && pt.Y >= cs.YLimMin && pt.Y <= cs.YLimMax)
ds.SymbolStyle.DrawSymbol (g, cs.Point2D((CGPoint)ds.PointList[i]));
}
}
}