本文整理汇总了C#中System.Drawing.Drawing2D.GraphicsPath.AddLines方法的典型用法代码示例。如果您正苦于以下问题:C# GraphicsPath.AddLines方法的具体用法?C# GraphicsPath.AddLines怎么用?C# GraphicsPath.AddLines使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Drawing2D.GraphicsPath
的用法示例。
在下文中一共展示了GraphicsPath.AddLines方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ColorPicker
public ColorPicker()
{
this.InitializeComponent();
base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
this.SetColorRGB(0, 0, 0);
using (Graphics graphics = Graphics.FromImage(this.hues))
{
for (int i = 0; i < (this.hues.Height - 2); i++)
{
using (SolidBrush brush = new SolidBrush(HSVColor(0xff - i, 0xff, 0xff)))
{
graphics.FillRectangle(brush, 0, i, this.hues.Width, 1);
}
}
}
using (Graphics graphics2 = Graphics.FromImage(this.leftArrow))
{
PointF[] points = new PointF[] { new Point(0, 0), new Point(5, 5), new Point(0, 10), new Point(0, 0) };
GraphicsPath path = new GraphicsPath();
path.AddLines(points);
graphics2.FillPath(Brushes.Black, path);
}
using (Graphics graphics3 = Graphics.FromImage(this.rightArrow))
{
PointF[] tfArray2 = new PointF[] { new Point(5, 0), new Point(0, 5), new Point(5, 10), new Point(5, 0) };
GraphicsPath path2 = new GraphicsPath();
path2.AddLines(tfArray2);
graphics3.FillPath(Brushes.Black, path2);
}
this.paletteBox.BackgroundImage = this.palette;
this.hueSlider.BackgroundImage = this.hues;
this.UpdatePalette();
}
示例2: OnDraw
/// <summary>
/// Draws the point symbol in the view
/// </summary>
/// <param name="g"></param>
/// <param name="clip"></param>
protected virtual void OnDraw(Graphics g, Rectangle clip)
{
if (_borderStyle == BorderStyle.Fixed3D)
{
g.DrawLine(Pens.White, 0, Height - 1, Width - 1, Height - 1);
g.DrawLine(Pens.White, Width - 1, 0, Width - 1, Height - 1);
g.DrawLine(Pens.Gray, 0, 0, 0, Height - 1);
g.DrawLine(Pens.Gray, 0, 0, Width - 1, 0);
}
if (_borderStyle == BorderStyle.FixedSingle)
{
g.DrawRectangle(Pens.Black, 0, 0, Width - 1, Height - 1);
}
int w = Width;
int h = Height;
if (_symbolizer == null) return;
int lineWidth = Convert.ToInt32(_symbolizer.GetWidth());
if (lineWidth > 128) lineWidth = 128;
if (lineWidth < 1) lineWidth = 1;
GraphicsPath gp = new GraphicsPath();
gp.AddLines(new[]{new Point(lineWidth, (h * 2) / 3), new Point(w/3, h / 3), new Point((w * 2) / 3, (h*2)/3), new Point(w - lineWidth, h/3)});
_symbolizer.DrawPath(g, gp, 1);
}
示例3: DrawPointerDown
private void DrawPointerDown(Graphics g)
{
Point[] points = new Point[] { new Point(ThumbBounds.Left + (ThumbBounds.Width / 2), ThumbBounds.Bottom - 1), new Point(ThumbBounds.Left, (ThumbBounds.Bottom - (ThumbBounds.Width / 2)) - 1), ThumbBounds.Location, new Point(ThumbBounds.Right - 1, ThumbBounds.Top), new Point(ThumbBounds.Right - 1, (ThumbBounds.Bottom - (ThumbBounds.Width / 2)) - 1), new Point(ThumbBounds.Left + (ThumbBounds.Width / 2), ThumbBounds.Bottom - 1) };
GraphicsPath path = new GraphicsPath();
path.AddLines(points);
Region region = new Region(path);
g.Clip = region;
if (ThumbState == 3 || !base.Enabled)
ControlPaint.DrawButton(g, ThumbBounds, ButtonState.All);
else
g.Clear(SystemColors.Control);
g.ResetClip();
region.Dispose();
path.Dispose();
Point[] pointArray2 = new Point[] { points[0], points[1], points[2], points[3] };
g.DrawLines(SystemPens.ControlLightLight, pointArray2);
pointArray2 = new Point[] { points[3], points[4], points[5] };
g.DrawLines(SystemPens.ControlDarkDark, pointArray2);
points[0].Offset(0, -1);
points[1].Offset(1, 0);
points[2].Offset(1, 1);
points[3].Offset(-1, 1);
points[4].Offset(-1, 0);
points[5] = points[0];
pointArray2 = new Point[] { points[0], points[1], points[2], points[3] };
g.DrawLines(SystemPens.ControlLight, pointArray2);
pointArray2 = new Point[] { points[3], points[4], points[5] };
g.DrawLines(SystemPens.ControlDark, pointArray2);
}
示例4: ProgressControl
public ProgressControl()
{
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.ResizeRedraw, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
pnOutln = new Pen(cOutln, iOutlln);
rcArea = new Rectangle[5];
for (int i = 0; i < 5; ++i) {
rcArea[i].X = i * (iWidth + iPad);
rcArea[i].Width = iWidth + iPad;
rcArea[i].Height = iHeight;
}
//setup arrow shape
gpBlock = new GraphicsPath();
gpBlock.AddLines(new PointF[] {
new PointF(0, 0), //TL
new PointF(iWidth - iPad, 0), //TR
new PointF(iWidth, iHeight / 2), //MR
new PointF(iWidth - iPad, iHeight), //BR
new PointF(0, iHeight), //BL
new PointF(iPad, iHeight / 2) //ML
});
gpBlock.CloseFigure();
}
示例5: paintshit
void paintshit(List<double> datta, int numPoints, double mulX, double mulY, int bw, int bh, Graphics g, LinearGradientBrush grad, Color cbase)
{
PointF[] points = new PointF[numPoints];
lock (datta)
{
int s = 0;
int samples = datta.Count;
for (; s < (points.Length - 2) - samples; s++)
{
points[s + 1] = new PointF((float)(s * mulX), bh);
}
int ofs = (points.Length - 2) - samples;
s = Math.Max(0, samples - (points.Length - 2));
for (; s < samples; s++)
{
points[s + ofs + 1] = new PointF((float)((s + ofs) * mulX),
(float)(bh - datta[s] * mulY));
}
points[0] = new PointF(0f, bh);
points[points.Length - 1] = new PointF(bw, bh);
}
GraphicsPath gp = new GraphicsPath();
gp.AddLines(points);
g.FillPath(grad, gp);
g.DrawPath(new Pen(cbase, 2f), gp);
}
示例6: StarRatingControl
/// <summary>
/// Initializes the control with default values
/// </summary>
public StarRatingControl()
{
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.ResizeRedraw, true);
pnOutln = new Pen(cOutln, iOutThick);
rcArea = new Rectangle[iStarCount];
for (int i = 0; i < iStarCount; ++i) {
rcArea[i].X = i * (iWidth + iPadding);
rcArea[i].Width = iWidth + iPadding;
rcArea[i].Height = iHeight;
}
//setup star shape (from top tip and in thirds)
gpStar = new GraphicsPath();
PointF[] pfStar = new PointF[10];
pfStar[0] = new PointF(iWidth / 2, 0); //12:00
pfStar[1] = new PointF(2 * iWidth / 3, iHeight / 3); //01:00
pfStar[2] = new PointF(iWidth, iHeight / 3); //02:00
pfStar[3] = new PointF(4 * iWidth / 5, 4 * iHeight / 7); //03:00
pfStar[4] = new PointF(5 * iWidth / 6, iHeight); //04:00
pfStar[5] = new PointF(iWidth / 2, 4 * iHeight / 5); //06:00
pfStar[6] = new PointF(iWidth - pfStar[4].X, pfStar[4].Y); //08:00
pfStar[7] = new PointF(iWidth - pfStar[3].X, pfStar[3].Y); //09:00
pfStar[8] = new PointF(iWidth - pfStar[2].X, pfStar[2].Y); //10:00
pfStar[9] = new PointF(iWidth - pfStar[1].X, pfStar[1].Y); //11:00
gpStar.AddLines(pfStar);
gpStar.CloseFigure();
}
示例7: DrawBezierCtrlLines
//------------------------------------------------------------------------------
private static void DrawBezierCtrlLines(Graphics graphics,
MultiPathSegment mps, uint color)
{
int cnt = mps.Count;
if (cnt < 2) return;
Pen pen = new Pen(MakeColor(color));
GraphicsPath gpath = new GraphicsPath();
PointF[] pts = new PointF[2];
pts[0] = PathToPointF(mps[0]);
pts[1] = PathToPointF(mps[1]);
gpath.StartFigure();
gpath.AddLines(pts);
if (mps.IsValid())
if (mps.curvetype == CurveType.CubicBezier)
{
pts[0] = PathToPointF(mps[2]);
pts[1] = PathToPointF(mps[3]);
gpath.StartFigure();
gpath.AddLines(pts);
}
else
{
pts[0] = PathToPointF(mps[2]);
gpath.StartFigure();
gpath.AddLines(pts);
}
graphics.DrawPath(pen, gpath);
pen.Dispose();
gpath.Dispose();
}
示例8: GetDiamondPath
private GraphicsPath GetDiamondPath(Rectangle rectangle)
{
Point[] points = new Point[] { new Point(rectangle.Left + (rectangle.Width / 2), rectangle.Top), new Point(rectangle.Right - 1, rectangle.Top + (rectangle.Height / 2)), new Point(rectangle.Left + (rectangle.Width / 2), rectangle.Bottom - 1), new Point(rectangle.Left, rectangle.Top + (rectangle.Height / 2)), new Point(rectangle.Left + (rectangle.Width / 2), rectangle.Top) };
GraphicsPath path = new GraphicsPath();
path.AddLines(points);
path.CloseFigure();
return path;
}
示例9: DrawLineString
/// <summary>
/// Renders a LineString to the map.
/// </summary>
/// <param name="g">Graphics reference</param>
/// <param name="line">LineString to render</param>
/// <param name="pen">Pen style used for rendering</param>
/// <param name="map">Map reference</param>
public static void DrawLineString(System.Drawing.Graphics g, Geometries.LineString line, System.Drawing.Pen pen, SharpMap.Map map)
{
if (line.Vertices.Count > 1)
{
System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
gp.AddLines(line.TransformToImage(map));
g.DrawPath(pen, gp);
}
}
示例10: DrawLineString
public static void DrawLineString(Graphics graphics, LineString line, Pen pen, IViewport viewport)
{
if (line.Vertices.Count > 1)
{
var gp = new GraphicsPath();
gp.AddLines(ConvertPoints(WorldToView(line, viewport)));
graphics.DrawPath(pen, gp);
}
}
示例11: DrawLineString
/// <summary>
/// Renders a LineString to the map.
/// </summary>
/// <param name="g">Graphics reference</param>
/// <param name="line">LineString to render</param>
/// <param name="pen">Pen style used for rendering</param>
/// <param name="map">Map reference</param>
public static void DrawLineString(System.Drawing.Graphics g, ILineString line, System.Drawing.Pen pen, SharpMap.Map map)
{
if (line.Coordinates.Length > 1)
{
System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
gp.AddLines(Transform.TransformToImage(line, map));
g.DrawPath(pen, gp);
}
}
示例12: NextMarker_Null
public void NextMarker_Null ()
{
using (GraphicsPath gp = new GraphicsPath ()) {
gp.AddLines (pts_2f);
using (GraphicsPathIterator gpi = new GraphicsPathIterator (gp)) {
Assert.AreEqual (0, gpi.NextMarker (null));
}
}
}
示例13: CopyData_NullPoints
public void CopyData_NullPoints ()
{
using (GraphicsPath gp = new GraphicsPath ()) {
gp.AddLines (pts_2f);
using (GraphicsPathIterator gpi = new GraphicsPathIterator (gp)) {
PointF [] points = null;
byte [] types = new byte [1];
Assert.AreEqual (0, gpi.CopyData (ref points, ref types, 0, 1));
}
}
}
示例14: NextSubpath_Null
public void NextSubpath_Null ()
{
using (GraphicsPath gp = new GraphicsPath ()) {
gp.AddLines (pts_2f);
using (GraphicsPathIterator gpi = new GraphicsPathIterator (gp)) {
bool closed;
Assert.AreEqual (0, gpi.NextSubpath (null, out closed));
Assert.IsTrue (closed, "Closed");
}
}
}
示例15: DrawLine
public void DrawLine(Line line, Graphics graphs)
{
var path = new GraphicsPath();
path.AddLines(line.Vertices.ToPoints());
using (var p = new Pen(line.OutlineColor, line.OutlineWidth))
{
p.DashStyle = line.OutlineDash;
graphs.DrawPath(p, path);
}
}