Problem with a drawing program in visual basic 2008 (c sharp)(gui)
Hello all,
I am learning myself c sharp and for that I have been working on a drawing program where the user is capable of drawing lines in 3 different strokes and 4 different colors,
My first problem is how to let the user make a line by 2 mouseclicks on the panel.
This is the code I have so far:
Namespace WindowsFormsApplication1
Code:
namespace WindowsFormsApplication1{
public partial class Form1 : Form
{
Graphics e;
Pen p;
Point punt1, punt2;
int nPunt = 0;
public Form1()
{
InitializeComponent();
p = new Pen(Color.Black);
}
public void tekenpaneel_MouseClick(object sender, MouseEventArgs e)
{
if (nPunt == 0)
{
punt1 = new Point(e.X, e.Y);
nPunt++;
}
else if (nPunt == 1)
{
punt2 = new Point(e.X, e.Y);
nPunt = 0;
}
}
public void tekenpaneel_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawLine( p, punt1, punt2);
}
}
}
I don't got any errors but the program isn't doing anything when I click on the panel, I would be verry gratefull if someone could help me out :)