|
-
Jul 27th, 2003, 01:06 AM
#1
Thread Starter
Member
-
Jul 27th, 2003, 06:50 AM
#2
Sleep mode
Paste a lable into the form , make the height =1 and the width =any number . Now , it's like the line control in VB6 .
Last edited by Pirate; Jul 27th, 2003 at 07:09 AM.
-
Jul 27th, 2003, 10:19 AM
#3
Thread Starter
Member
Hmmm
Though that does work, I really want to know how to do it codewise. Someone please help!
-
Jul 27th, 2003, 10:38 AM
#4
Sleep mode
The code you posted draws a line .
-
Jul 27th, 2003, 11:08 AM
#5
try this , you should get a red line across your form
VB Code:
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
With e.Graphics
Dim p As New Pen(Color.Red, 5)
.DrawLine(p, 0, 50, Me.Width, 50)
End With
End Sub
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Jul 27th, 2003, 11:19 AM
#6
Thread Starter
Member
YaY
Originally posted by dynamic_sysop
try this , you should get a red line across your form
VB Code:
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
With e.Graphics
Dim p As New Pen(Color.Red, 5)
.DrawLine(p, 0, 50, Me.Width, 50)
End With
End Sub
This works but how is it called? Should I call it from my form_load?
-
Jul 27th, 2003, 11:22 AM
#7
Re: YaY
Originally posted by UConnVendetta
This works but how is it called? Should I call it from my form_load?
It loads by itself when the form is created.
-
Jul 27th, 2003, 12:00 PM
#8
if you do it in Form_Paint , as i did , it will always put the line there ( starting from the moment you load the form )
also you should try to avoid calling an item by a keyword / expression ( eg: Pen as Pen ) use something else like " P as Pen " or MyPen as Pen " , this occassionally causes errors and can mislead you
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Jul 27th, 2003, 12:23 PM
#9
Thread Starter
Member
I see........
So you're right. OK. I don't know why it wasnt workings for me. Maybe because I was trying to put it in Form_Load instead of Form_Paint. But Whatever....
Well here's some random knowledge about VB.net:
VB Code:
If you_make_a_form_hide And show_a_new_form Then
'when you decide to close the form by hitting the X
theFormWill.Close()
'but the previous form that was hidden will remain in memory.
End If
'to make sure no part of your program stays in the memory,
'after closing your app you need the following sub:
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
'and inside the sub you need the word
End 'this will close all forms, and all open project files.
End Sub
-
Jul 28th, 2003, 02:54 AM
#10
Hyperactive Member
You could draw a line in the Paint event, and every time the object is painted, it will draw that line.
VB Code:
Private Sub Button1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Button1.Paint
'This example will draw two lines creating an X on the Button1 object.
Dim myPen As Pen = New Pen(Color.Red)
e.Graphics.DrawLine(myPen, 0, 0, e.ClipRectangle.Width, e.ClipRectangle.Height)
e.Graphics.DrawLine(myPen, 0, e.ClipRectangle.Height, e.ClipRectangle.Width, 0)
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|