473,799 Members | 3,006 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(...)h andles...
Me.Invalidate()
End Sub

Private Sub Panel1_Paint(By Val sender As Object, ByVal e As
System.Windows. Forms.PaintEven tArgs) Handles Panel1.Paint
If rad.Checked.Equ als(True) Then
Dim bPen As Pen
bPen = New Drawing.Pen(Col or.Blue, 3)
e.Graphics.Draw Line(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 2123
Panel1.Invalida te

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(...)h andles...
Me.Invalidate()
End Sub

Private Sub Panel1_Paint(By Val sender As Object, ByVal e As
System.Windows. Forms.PaintEven tArgs) Handles Panel1.Paint
If rad.Checked.Equ als(True) Then
Dim bPen As Pen
bPen = New Drawing.Pen(Col or.Blue, 3)
e.Graphics.Draw Line(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
2729
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 another line, connecting User1's, and User2's current X,Y position. Same thing happens with User2. But User3, and User4 is not drawing, and see the lines drawn individually.
8
3836
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? I've found a few offerings but either they weren't multi-browser compatible or they were too big for me to consider (20K instead of 2 or 3K). Andrew Poulos
6
30751
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
1244
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 on a 3x3 image and show schematic representations of obtained images (where o means a drawn pixel) import Image, ImageDraw
1
1634
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 be very annoying for some applications where precise geometry does matter. Below I test this function on a 3x3 image and show schematic representations of obtained images (where o means a drawn pixel)
0
2884
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 below: chartGenerator.vb class: Imports System.Drawing.Imaging Public Class chartGenerator Private myImage As Bitmap
2
8046
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 pixels wide (the line I'm trying to "copy" or draw), but this drawn polyline is very thin, probably 1 pixel wide. Any way to change the thickness of a drawn line like this? Like another class? I've looked at graphics2D and I see no extra possibility...
0
1369
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 label however the line wont draw when i have 1 taskbox move away from another taskbox. The line is gone at last sec when taskbox move away. could someone please tell me where does I made mistake and how to fix it thank you Below is the code.
0
1386
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 gs As Integer = 34 Private Const hw As Integer = 6 Private Const hhw As Integer = hw \ 2 Private bf As Bitmap Private drag As Integer = -1 Private pts() As Point Private Sub Form1_Load(ByVal sender As System.Object,...
0
9546
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10490
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10260
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10243
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10030
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9078
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5590
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.