lineplot.cs
来自「c#设计模式随书源码 c#设计模式随书源码」· CS 代码 · 共 32 行
CS
32 行
using System;
using System.Drawing ;
using System.Windows.Forms;
namespace Strategy {
/// <summary>
/// Summary description for LinePlot.
/// </summary>
public class LinePlot :BarPlot {
public LinePlot() {
init();
}
protected override void init() {
base.init ();
bPen = new Pen(Color.Black);
this.Text = "Line Plot";
}
//protected override void pic_Paint(object sender, PaintEventArgs e) {
public override void repaint(Graphics g) {
//Graphics g= e.Graphics;
if (hasData) {
for (int i = 1; i< x.Length; i++) {
int ix = calcx(x[i - 1]);
int iy = calcy(y[i - 1]);
int ix1 = calcx(x[i]);
int iy1 = calcy(y[i]);
g.DrawLine(bPen, ix, iy, ix1, iy1);
}
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?