我正在尝试制作一个Windows窗体应用程序,它将显示函数图。
我如何拉伸图表,使其更偏向侧面?
private void Graphs_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawLine(new Pen(Color.Black), 0, ClientSize.Height / 2, ClientSize.Width, ClientSize.Height / 2);
e.Graphics.DrawLine(new Pen(Color.Black), ClientSize.Width / 2, 0, ClientSize.Width / 2, ClientSize.Height);
for (double x = -100; x < 100; x += 0.1)
{
double y = x * x * -1;
//y = x * -1;
//y = Math.Sqrt(x) * -1;
//y = 1 / x;
try
{
e.Graphics.FillEllipse(new SolidBrush(Color.Red), (ClientSize.Width / 2) - 5 + Convert.ToInt32(x), (ClientSize.Height / 2) - 5 + Convert.ToInt32(y), 10, 10);
}
catch (Exception)
{
}
}
}