我正在做一个数值分析项目,我想在表格上绘制图形和抛物线。只是我想画一条抛物线x² - 2x - 1
。那么,我该怎么做呢?
示例代码:
g = this.CreateGraphics();
p = new Pen(Brushes.WhiteSmoke,1);
s = new SolidBrush(Color.Blue);
g.DrawString("x", this.Font, s, x1, y0 + 10);
g.DrawString("y", this.Font, s, x0 - 5, y2 - 20);
g.DrawRectangle(p, 400, 100, 300, 300);
for (int i = 0; i < 300; i += 30)
{
line(400, 100 + i, 700, 100 + i);
}
public void line(int x, int y, int x1, int y1)
{
g = this.CreateGraphics();
p = new Pen(Brushes.Gray, 1);
g.DrawLine(p, x, y, x1, y1);
g.Dispose();
}