本文整理汇总了C#中Graphics.DrawLines方法的典型用法代码示例。如果您正苦于以下问题:C# Graphics.DrawLines方法的具体用法?C# Graphics.DrawLines怎么用?C# Graphics.DrawLines使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graphics
的用法示例。
在下文中一共展示了Graphics.DrawLines方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public override void Draw(Graphics e)
{
Point[] PointArray = new Point[PointList.Count];
PointArray = PointList.ToArray();
for (int i = 0; i < PointList.Count; i++)
e.DrawLines(new Pen(Color.Black), PointArray);
}
示例2: DrawRandomLines
private void DrawRandomLines(Graphics g)
{
SolidBrush linecolor = new SolidBrush(Color.DarkSlateGray);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
for (int i = 0; i < 10; i++)
{
g.DrawLines(new Pen(linecolor, 1), GetRandomPoints());
}
}
示例3: DrawLineString
private void DrawLineString(Graphics graphics, ILineString lineString, Pen pen)
{
lineString = _transform.ReverseTransform(lineString);
PointF[] points = new PointF[lineString.Coordinates.Length];
for (int i = 0; i < lineString.Coordinates.Length; ++i)
{
points[i].X = Convert.ToSingle(lineString.Coordinates[i].X * _resolution);
points[i].Y = Convert.ToSingle(lineString.Coordinates[i].Y * _resolution);
}
graphics.DrawLines(pen, points);
}
示例4: DrawData
private void DrawData(Graphics g, float Xunit, float Yunit)
{
int i = 0;
for (i = 0; i < 100; i++)
{
int Freq = FreqCount[i];
float y = HEIGHT - NETAREABOTTOMMARGIN - Freq * Yunit;
float x = i*Xunit + NETAREALEFTMARGIN;
Pen dataPen = new Pen(Brushes.LightSkyBlue, 3);
g.DrawLine(dataPen, x, y, x, (float)HEIGHT - NETAREABOTTOMMARGIN);
}
Pen ThresholdPen = new Pen(Brushes.Green , 2);
if (threshold > 0)
{
//ThresholdPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
float thresholdx = threshold * Xunit + NETAREALEFTMARGIN;
g.DrawLine(ThresholdPen, thresholdx, NETAREATOPMARGIN, thresholdx, (float)HEIGHT - NETAREABOTTOMMARGIN);
}
PointF[] FalsePoint = new PointF[100];
PointF[] TruePoint = new PointF[100];
for (i = 0; i < 100; i++)
{
float x = i*Xunit + NETAREALEFTMARGIN;
float Freq = (float)(falseNumber * Math.Exp((-1 * (i - miu1) * (i - miu1)) / (2 * sigma1*sigma1)) / (Math.Sqrt(2 * Math.PI) * sigma1));
float Freq2 = (float)(trueNumber * Math.Exp((-1 * (i - miu2) * (i - miu2)) / (2 * sigma2 * sigma2)) / (Math.Sqrt(2 * Math.PI) * sigma2));
float y = HEIGHT - NETAREABOTTOMMARGIN - Freq * Yunit;
float y2 = HEIGHT - NETAREABOTTOMMARGIN - Freq2 * Yunit;
PointF fpf = new PointF(x, y);
PointF tpf = new PointF(x, y2);
FalsePoint[i] = fpf;
TruePoint[i] = tpf;
}
Pen falsePen = new Pen (Brushes.Red,2);
falsePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
Pen truePen = new Pen (Brushes.Blue ,2);
truePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
Font legendFont = new Font("Arial",10,FontStyle.Regular );
g.DrawLine(falsePen, new Point(WIDTH - 150, NETAREATOPMARGIN+8), new Point(WIDTH - 110, NETAREATOPMARGIN+8));
g.DrawString("False Match", legendFont, Brushes.Red, new PointF(WIDTH - 100, NETAREATOPMARGIN));
g.DrawLines(falsePen, FalsePoint);
g.DrawLine(truePen, new Point(WIDTH - 150, NETAREATOPMARGIN+24), new Point(WIDTH - 110, NETAREATOPMARGIN + 24));
g.DrawString("True Match", legendFont, Brushes.Blue , new PointF(WIDTH - 100, NETAREATOPMARGIN+16));
g.DrawLines(truePen, TruePoint);
g.DrawLine(ThresholdPen, new Point(WIDTH - 150, NETAREATOPMARGIN + 40), new Point(WIDTH - 110, NETAREATOPMARGIN+40));
g.DrawString("Threshold", legendFont, Brushes.Green, new PointF(WIDTH - 100, NETAREATOPMARGIN + 32));
}
示例5: DrawCross
private void DrawCross(Graphics graphics, IPoint point, Pen pen, double size)
{
point = _transform.ReverseTransform(point);
size *= 0.5;
PointF[] points = new PointF[2];
points[0].X = Convert.ToSingle((point.Coordinate.X - size) * _resolution);
points[0].Y = Convert.ToSingle(point.Coordinate.Y * _resolution);
points[1].X = Convert.ToSingle((point.Coordinate.X + size) * _resolution);
points[1].Y = Convert.ToSingle(point.Coordinate.Y * _resolution);
graphics.DrawLines(pen, points);
points[0].X = Convert.ToSingle(point.Coordinate.X * _resolution);
points[0].Y = Convert.ToSingle((point.Coordinate.Y - size) * _resolution);
points[1].X = Convert.ToSingle(point.Coordinate.X * _resolution);
points[1].Y = Convert.ToSingle((point.Coordinate.Y + size) * _resolution);
graphics.DrawLines(pen, points);
}
示例6: Draw
// Draw the graphics path
public void Draw(Graphics graphics, Pen pen)
{
/*
foreach( PathObject o in pathObjs ) {
o.Draw( graphics, pen );
}
*/
PointF [] poly = GetPathPoints();
if( poly.Length > 1 ) {
graphics.DrawLines(pen, poly);
}
foreach( PathObject o in pathObjs ) {
if( !o.HasPathPoints ) o.Draw( graphics, pen );
}
}
示例7: Fill
// Fill this path object.
public override void Fill(Graphics graphics, Brush brush,
Pen penBrush, FillMode fillMode)
{
graphics.DrawLines(penBrush, points);
}
示例8: Draw
public void Draw(Graphics g)
{
Point [] poly = new Point [data.Count + 2];
for (int i = 0; i < poly.Length; i ++)
poly [i].Y = ysize;
poly [0] = new Point (0, 0);
poly [poly.Length - 1] = new Point (xsize, 0);
poly [poly.Length - 2] = new Point (xsize, ysize);
for (int i = -1; i < tl.TypeIndexes.Length; i ++) {
Brush b;
if (i == -1)
b = Brushes.DarkGray;
else
b = tl.TypeBrushes [i];
g.FillPolygon (b, poly);
int j = 1;
foreach (TimePoint tp in data) {
int psize;
if (i == -1)
psize = tp.OtherSize;
else
psize = tp.TypeData [i];
poly [j].X = tp.X;
poly [j].Y -= checked ((int)((long)psize * (long) ysize / (long)Profile.MaxSize));
j ++;
}
}
g.FillPolygon (Brushes.White, poly);
{
Point [] line = new Point [data.Count];
int j = 0;
foreach (TimePoint tp in data) {
int psize = tp.HeapSize;
line [j].X = tp.X;
line [j].Y = ysize - checked ((int)((long)psize * (long) ysize / (long)Profile.MaxSize));
j ++;
}
g.DrawLines (Pens.Black, line);
}
#if DEBUG_GRAPH_SIZE
{
Point [] line = new Point [data.Count];
int j = 0;
foreach (TimePoint tp in data) {
int psize = tp.Data.TotalSize;
line [j].X = tp.X;
line [j].Y = ysize - checked ((int)((long)psize * (long) ysize / (long)Profile.MaxSize));
j ++;
}
g.DrawLines (Pens.Black, line);
}
#endif
}