Hey, I have button in a Form, I implemented its Click handler as when its clicked an X is drawn.... I obtained the Graphics using the CreateGraphics() method of the button used it to call the DrawLine methods..
When I click it, it draws the line properly but when I move the mouse outside the button's boundary it vanishes. why?
the code for the click event handler is
Code:
private void button1_Click(object sender, EventArgs e)
{
Graphics g = button1.CreateGraphics();
g.DrawLine(new Pen(Color.Black), 20, 20, 200, 200);
g.DrawLine(new Pen(Color.Black), 200, 20, 20, 200);
}