473,325 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

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


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
1 2094
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: C. Alexander | last post by:
I'm making a 'whiteboard' application. I'm trying to have 2+ connected users able to draw at the same time. However, if User1 draws a line, when User2 is drawing, on User1 screen, it will draw...
8
by: Andrew Poulos | last post by:
Is there a small graphics library that I can use? All I need to do is draw a line of a nominated thickness and colour between two specified points and to, at some later time, "delete" the line? ...
6
by: R | last post by:
Hello everybody! I'm newbie to JavaScript and I have a basic question. I have X and Y coordinates of A and B points. How can I draw a line connecting A and B? thanks in advance cheers
0
by: alexandre_irrthum | last post by:
Hi there, I am puzzled by the comportment of the line function from the ImageDraw module with regard to the way it draws or does not draw the last pixel of a line. Below I test this function...
1
by: alexandre_irrthum | last post by:
Hi there, Sorry to repost this, but I didn't get any answer one month ago. In essence, it seems that the ImageDraw line function draws lines one pixel shorter in some circumstances. This could...
0
by: benfly08 | last post by:
Hi, guys. I have a program to draw bar/pie chart based on the data i hard coded in it. However, my image comes with "BLACK" background color. I don't know how to fix this. The code snippet is...
2
blazedaces
by: blazedaces | last post by:
Hey, I have an application that draws a polyline with Graphics': g.drawPolyline(getXPoints(),getYPoints(),nPoints); It's drawn onto a background image and so the background image is so many...
0
by: qutspan | last post by:
When I create taskbox on the form the line beside the box wont show up. it show up untill I have MouseEnter event occur. Also when I have 2 taskbox on the form it does draw the line around the...
0
by: kam45 | last post by:
I did one program that draws a line with two squares at the ends and I can just click and extend each ends. It works ok but I need to move the whole line. Would anyone knows how? Private Const...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.