By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,995 Members | 1,266 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,995 IT Pros & Developers. It's quick & easy.

line wont draw after button click but draws after tab or alt keypr

P: n/a

Hello,

I have a form with a panel which contains a radiobutton. When I click the
radiobutton, I invoke the Paint event of the panel using me.Invalidate. The
paint event gets called and runs through code to draw a line. But the line
does not draw on the panel until I press either the Alt key or Tab key. Here
is my code:

Sub rad_Click(...)handles...
Me.Invalidate()
End Sub

Private Sub Panel1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
If rad.Checked.Equals(True) Then
Dim bPen As Pen
bPen = New Drawing.Pen(Color.Blue, 3)
e.Graphics.DrawLine(bPen, 0, 186, 446, 186)
End If
End Sub

How can I make the line draw when I check the radionbutton?

Thanks,
Rich
Aug 1 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Panel1.Invalidate

I have to invalidate the Panel where I want to draw the line. Now it is
working.

"Rich" wrote:
>
Hello,

I have a form with a panel which contains a radiobutton. When I click the
radiobutton, I invoke the Paint event of the panel using me.Invalidate. The
paint event gets called and runs through code to draw a line. But the line
does not draw on the panel until I press either the Alt key or Tab key. Here
is my code:

Sub rad_Click(...)handles...
Me.Invalidate()
End Sub

Private Sub Panel1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
If rad.Checked.Equals(True) Then
Dim bPen As Pen
bPen = New Drawing.Pen(Color.Blue, 3)
e.Graphics.DrawLine(bPen, 0, 186, 446, 186)
End If
End Sub

How can I make the line draw when I check the radionbutton?

Thanks,
Rich
Aug 1 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.