本文整理汇总了C#中System.Drawing.Graphics.DrawLines方法的典型用法代码示例。如果您正苦于以下问题:C# Graphics.DrawLines方法的具体用法?C# Graphics.DrawLines怎么用?C# Graphics.DrawLines使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Graphics
的用法示例。
在下文中一共展示了Graphics.DrawLines方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawPath
public void DrawPath(Graphics g, Pen p)
{
if (m_points != null)
{
g.DrawLines(p, m_points);
}
}
示例2: Frame3D
public static void Frame3D(Graphics graphics, Rectangle rc, Color topColor, Color bottomColor, int width)
{
if(graphics == null)
throw new ArgumentNullException("graphics");
Pen pen = new Pen(topColor, 1);
pen.Width = 1;
while(width > 0)
{
width--;
pen.Color = topColor;
Point[] top_pnts =
{
new Point(rc.Left, rc.Bottom),
new Point(rc.Left, rc.Top),
new Point(rc.Right, rc.Top)
};
graphics.DrawLines(pen, top_pnts);
pen.Color = bottomColor;
Point[] bottom_pnts =
{
new Point(rc.Right, rc.Top),
new Point(rc.Right, rc.Bottom),
new Point(rc.Left, rc.Bottom)
};
graphics.DrawLines(pen, bottom_pnts);
rc.Inflate(-1, -1);
}
pen.Dispose();
}
示例3: DrawHouse
private void DrawHouse(Graphics g, int mouseX, int mouseY)
{
Point topLeft = new Point(mouseX, mouseY);
Point topRight = new Point(mouseX + size, mouseY);
Point bottomLeft = new Point(mouseX, mouseY + size);
Point bottomRight = new Point(mouseX + size, mouseY + size);
Point top = new Point(mouseX + (size / 2), mouseY - (int)(size * 0.5));
Point doorBottomLeft = new Point(bottomLeft.X + (int)(size * 0.2), bottomLeft.Y);
Point doorBottomRight = new Point(bottomLeft.X + (int)(size * 0.5), bottomLeft.Y);
Point doorTopLeft = new Point(doorBottomLeft.X, doorBottomLeft.Y - (int)(size * 0.6));
Point doorTopRight = new Point(doorBottomRight.X, doorBottomRight.Y - (int)(size * 0.6));
Point window1TopLeft = new Point(doorTopLeft.X, bottomLeft.Y - (int)(size * 0.9));
Point window2TopLeft = new Point(bottomLeft.X + (int)(size * 0.6), window1TopLeft.Y);
Point sunOrigin = new Point(topRight.X + (int)(size * 0.3), topRight.Y - (int)(size * 0.5));
Size windowSize = new Size((int)(size * 0.3), (int)(size * 0.2));
Size sunSize = new Size((int)(size * 0.4), (int)(size * 0.4));
Rectangle window1 = new Rectangle(window1TopLeft, windowSize);
Rectangle window2 = new Rectangle(window2TopLeft, windowSize);
Rectangle sun = new Rectangle(sunOrigin, sunSize);
Point[] square = new Point[] { topLeft, topRight, bottomRight, bottomLeft, topLeft, top, topRight };
Point[] door = new Point[] { doorBottomLeft, doorTopLeft, doorTopRight, doorBottomRight };
g.DrawLines(myPen, square);
g.DrawLines(myPen, door);
g.DrawRectangle(myPen, window1);
g.DrawRectangle(myPen, window2);
g.FillRectangle(myBrush, window1);
g.FillRectangle(myBrush, window2);
g.DrawEllipse(myPen, sun);
g.FillEllipse(yellow, sun);
}
示例4: Draw
public void Draw(Graphics graphics, int width, int height)
{
const int pixelsPerSample = 2;
var samplesLeft = GetSamplesToDraw(_left, width / pixelsPerSample).ToArray();
var samplesRight = GetSamplesToDraw(_right, width / pixelsPerSample).ToArray();
//left channel:
graphics.DrawLines(new Pen(Color.DeepSkyBlue, 1), GetPoints(samplesLeft, pixelsPerSample, width, height).ToArray());
//right channel:
graphics.DrawLines(new Pen(Color.FromArgb(150, Color.Red), 0.5f), GetPoints(samplesRight, pixelsPerSample, width, height).ToArray());
}
示例5: DrawCell
private void DrawCell(Graphics g, byte[,] cells, int row, int column, Rectangle bounds)
{
Rectangle area = new Rectangle(bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1);
g.DrawLines(Pens.LightGray, new Point[] {
new Point(area.Left, area.Bottom), new Point(area.Right, area.Bottom), new Point(area.Right, area.Top)});
if (currentCell.X == column && currentCell.Y == row)
{
g.FillRectangle(Brushes.Silver, bounds);
}
if (selectedCell.X == column && selectedCell.Y == row)
{
g.DrawRectangle(Pens.Black, area);
}
if (breakpoints.ContainsKey(new Point(column, row)))
{
g.FillEllipse(Brushes.Red, area);
}
char ch = (char)cells[row, column];
g.DrawString(ch.ToString(), baseFont, Brushes.Black, bounds.X + CellPadding, bounds.Y + CellPadding);
}
示例6: DrawSelf
public override void DrawSelf(Graphics gfx, Pen pen)
{
base.DrawSelf(gfx, pen);
PointF a = new PointF(Center.X + Width / 2, Center.Y);
PointF b = new PointF(Center.X - Width / 2, Center.Y + Height / 2);
PointF c = new PointF(Center.X - Width / 2, Center.Y - Height / 2);
PointF a1 = Calc.RotatePoint(Center, a, Angle);
PointF b1 = Calc.RotatePoint(Center, b, Angle);
PointF c1 = Calc.RotatePoint(Center, c, Angle);
gfx.DrawLines(pen, new PointF[4] { a1, b1, c1, a1 });
if (!Dummy)
{
Pen penn = new Pen(Color.Gainsboro, 1);
gfx.DrawEllipse(penn, Center.X - Range, Center.Y - Range, Range * 2, Range * 2);
}
if (Dummy)
{
gfx.DrawString((1000 / FireDelayMilis * TeslaBullet.DamageDefault).ToString(), new Font("Arial", 7), Brushes.Black, Center.X - (Width / 2), Center.Y - 15);
}
}
示例7: DrawSelf
/// <summary>
/// Draw self, including pathing line when tracking the Hero
/// </summary>
/// <param name="g"></param>
public override void DrawSelf( Graphics g )
{
if( pathToHero.Count >= 2 )
g.DrawLines( Pens.Green, (PointF[])(pathToHero.ToArray( typeof( PointF ) )) );
base.DrawSelf( g );
}
示例8: Draw
public override void Draw(Graphics g)
{
if (this.lineComponent.IsSelected)
{
g.DrawLine(ViewFactory.BoundingBoxPen, this.lineComponent.StartPoint.X, this.lineComponent.StartPoint.Y, this.lineComponent.ControlPoint1.X, this.lineComponent.ControlPoint1.Y);
g.DrawLine(ViewFactory.BoundingBoxPen, this.lineComponent.EndPoint.X, this.lineComponent.EndPoint.Y, this.lineComponent.ControlPoint2.X, this.lineComponent.ControlPoint2.Y);
}
if (this.lineComponent.ParentMoving)
{
g.DrawBezier(ViewFactory.LinePen,
this.lineComponent.StartPoint.MakePointF(),
this.lineComponent.ControlPoint1.MakePointF(),
this.lineComponent.ControlPoint2.MakePointF(),
this.lineComponent.EndPoint.MakePointF());
}
else
{
g.DrawLines(ViewFactory.LinePen, this.lineComponent.points.ToArray());
/*DrawPoint(g, new FlowChartPoint(points[points.Count/2].X,points[points.Count/2].Y),
GraphicsSettings.LabelPen, GraphicsSettings.EdgeBoxWidth);*/
}
DrawArrow(g, this.lineComponent.EndPoint, this.lineComponent.ControlPoint2,
ViewFactory.ArrowBrush,
ViewFactory.ArrowPen,
ViewFactory.ArrowLength);
if (this.lineComponent.IsSelected)
{
DrawPoint(g, this.lineComponent.ControlPoint1, ViewFactory.EdgePen, ViewFactory.EdgeBoxWidth);
DrawPoint(g, this.lineComponent.ControlPoint2, ViewFactory.EdgePen, ViewFactory.EdgeBoxWidth);
}
base.Draw(g);
}
示例9: Draw
public void Draw(Graphics graphics)
{
Point[] allPoints = GetDrawPoints();
Pen pen = new Pen(lineColour, lineThickness);
graphics.DrawLines(pen, allPoints);
}
示例10: Draw
///<summary>
/// Draw this Shape on graphics.
/// </summary>
/// <param name="graphics">Surfase for drawing.</param>
public override void Draw(Graphics graphics)
{
graphics.DrawLines(new Pen(Color, penWidth),
Points.Select(x => new Point(Position.X + x.X, Position.Y + x.Y)).ToArray());
graphics.DrawLine(new Pen(Color, penWidth),
new Point(Position.X + Points[Points.Count-1].X, Position.Y + Points[Points.Count-1].Y),
new Point(Position.X + Points[0].X, Position.Y + Points[0].Y));
}
示例11: Render
public static void Render(Graphics graphics, LineString line, Pen pen, IViewport viewport)
{
if (line.Vertices.Count > 1)
{
var points = GeometryRenderer.WorldToScreenGDI(line, viewport);
graphics.DrawLines(pen, points);
}
}
示例12: DoGrid
public static void DoGrid(this WidgetMidiList widget, FloatRect grid, Graphics g)
{
var gs = g.Save();
using (g.Clip = new Region(grid))
{
using (var p0 = new Pen(Color.Black)) foreach (var i in widget.GetHLines(4))
g.DrawLines(p0, new Point[] { new FloatPoint(i.XO, grid.Top), new FloatPoint(i.XO, grid.Bottom) });
using (var p1 = new Pen(Gray130)) foreach (var i in widget.GetHLines(Convert.ToInt32(Math.Pow(4, 2))))
g.DrawLines(p1, new Point[] { new FloatPoint(i.XO, grid.Top), new FloatPoint(i.XO, grid.Bottom) });
using (var p2 = new Pen(White)) foreach (var i in widget.GetHLines(Convert.ToInt32(Math.Pow(4, 3))))
g.DrawLines(p2, new Point[] { new FloatPoint(i.XO, grid.Top), new FloatPoint(i.XO, grid.Bottom) });
g.ResetClip();
}
g.Restore(gs);
}
示例13: Paint
protected internal override void Paint(Graphics gr)
{
//for now, no styles
gr.SmoothingMode = SmoothingMode.AntiAlias;
using(var pen = getContourPen(m_View.LineStyle))
{
gr.DrawLines(pen, m_Points);
}
}
示例14: drawGraphLine
private void drawGraphLine(Graphics graphics, PointF[] points, Pen pen, float yScale, float xScale)
{
var matrix = new Matrix();
matrix.Scale(xScale, yScale);
matrix.Translate(5, 5, MatrixOrder.Append);
matrix.TransformPoints(points);
graphics.DrawLines(pen, points);
}
示例15: Draw
public void Draw(Graphics g)
{
if (PointCount <= 1)
return;
Point[] pointArray = Points.ToArray();
Pen mypen = new Pen(penColor, penWidth);
g.DrawLines(mypen, pointArray);
}