I am having trouble drawing a line within a group box in a simple windows form.
here is my code:
public partial class Form1 : Form
{
publ
Hook up an event handler for the Paint
event of the GroupBox
and call DrawLShapeLine
from within that event handler instead. You should then use the Graphics
object supplied by in event arguments:
private void groupBox1_Paint(object sender, PaintEventArgs e)
{
DrawLShapeLine(e.Graphics, 10, 10, 20, 40);
}
As your code looks now it will attempt to paint in the GroupBox
when the form requires painting. The group box may be painted at any other occasion, which will the line you paint disappear.