J
jdf
I'm new to C# and this question is very elementary. In the code below,
CreateGraph is a button click event handler and Form1_Paint creates a
graphics object and draws a few lines. When the user clicks the button
(handled by CreateGraph), the graph is to be drawn on the form. However, I
don't what arguments I should use in the Form1_Paint call from the Create
Graph button click event handler. Any help would be most appreciated.
private void CreateGraph(object sender, System.EventArgs e)
{
Form1_Paint(what goes here?);
}
private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs
pe)
{
Graphics g = pe.Graphics;
Pen ThisPen = new Pen(Color.Black);
ThisPen.Width = 5;
g.DrawLine(ThisPen,5,5,20,30);
g.DrawLine(ThisPen,5,10,22,34);
g.DrawLine(ThisPen,5,15,31,40);
}
Thanks very much for any help.
CreateGraph is a button click event handler and Form1_Paint creates a
graphics object and draws a few lines. When the user clicks the button
(handled by CreateGraph), the graph is to be drawn on the form. However, I
don't what arguments I should use in the Form1_Paint call from the Create
Graph button click event handler. Any help would be most appreciated.
private void CreateGraph(object sender, System.EventArgs e)
{
Form1_Paint(what goes here?);
}
private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs
pe)
{
Graphics g = pe.Graphics;
Pen ThisPen = new Pen(Color.Black);
ThisPen.Width = 5;
g.DrawLine(ThisPen,5,5,20,30);
g.DrawLine(ThisPen,5,10,22,34);
g.DrawLine(ThisPen,5,15,31,40);
}
Thanks very much for any help.