本文整理汇总了C#中System.Drawing.Drawing2D.GraphicsPath.AddLine方法的典型用法代码示例。如果您正苦于以下问题:C# GraphicsPath.AddLine方法的具体用法?C# GraphicsPath.AddLine怎么用?C# GraphicsPath.AddLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Drawing2D.GraphicsPath
的用法示例。
在下文中一共展示了GraphicsPath.AddLine方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddLineExample
private void AddLineExample(PaintEventArgs e)
{
//Create a path and add a symetrical triangle using AddLine.
GraphicsPath myPath = new GraphicsPath();
myPath.AddLine(30, 30, 60, 60);
myPath.AddLine(60, 60, 0, 60);
myPath.AddLine(0, 60, 30, 30);
// Draw the path to the screen.
Pen myPen = new Pen(Color.Black, 2);
e.Graphics.DrawPath(myPen, myPath);
}
示例2: OnPaint
//引入命名空间
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Text;
using System.Windows.Forms;
public class Form1 : Form {
protected override void OnPaint(PaintEventArgs e) {
Graphics g = e.Graphics;
g.FillRectangle(Brushes.White, this.ClientRectangle);
GraphicsPath gp = new GraphicsPath();
gp.AddLine(10, 10, 10, 50);
gp.AddBezier(10, 50, 10, 55, 25, 70, 30, 70);
gp.AddLine(30, 70, 60, 70);
gp.StartFigure();
gp.AddLine(60, 110, 40, 160);
gp.CloseAllFigures();
g.DrawPath(Pens.Black, gp);
gp.Dispose();
}
public static void Main() {
Application.Run(new Form1());
}
}