Hello,
I have a panel that I have used as a control to be drawn on.
I want to handle say OnMouseHover or OnMouseDown events. To do this I used
Visual C# and it created a delegate called: panel1_OnMouseDown. I have
provided a snipet from the delegate:
private void panel1_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs mea)
{
if (mea.Button == MouseButtons.Left)
{
Graphics grfx = CreateGraphics();
Pen pen = new Pen(Color.AliceBlue, 20);
grfx.DrawLine(pen, 100, 100, 3000, 3000);
grfx.Dispose();
}
}
The problem I have (and as you can see from the very large pen and line
size) is that, while the code excutes, there is no visible line drawn. This
makes me think about the CreateGraphics method. Does the returned graphics
object(grfx) alow me to draw on the panel's client area or somewhere else?
If not on the panel, then how do I draw on the panel?
Thank you in advance,
Eric