我想用3點創建圖表,然後畫一條線。它將如下圖 ![c#form chart] [1] 但是我的編碼幾乎沒有劃線和沒有分數。請幫忙圖表點和劃線
public partial class Form5 : Form
{
public Form5()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Point[] pts = { new Point(150, 12), new Point(130, 15), new Point(160, 18) };
//int count = 0;
// pts[count] = new Point((int)NumericUpDown1.Value, (int)NumericUpDown2.Value);
for (int i = 0; i < pts.Length; i++)
{
if (i != 0)
{
this.CreateGraphics().DrawLine(new Pen(Brushes.Black, 3), pts[i - 1], pts[1]);
}
else
{
this.CreateGraphics().DrawLine(new Pen(Brushes.Black, 3), pts[i], pts[1]);
}
}
}
}
哪兒的例子圖表圖像去? – 2014-12-28 03:09:35