I don't see any line controls...
How would I draw a line without using a code?
Printable View
I don't see any line controls...
How would I draw a line without using a code?
You can use the label control. Set the width to 2 and set the borderstyle to single, then make the lenght whatever you want.
That's a funny way to do it :D
So there isn't a way to use a color for that "line" or change the width of the line?
Well there are other ways. You can use GDI+ to draw the line on the form, but you'll have to use code. If you do it that way, you can change width and color. The label control does'nt give you much options, but it works :D
Of course, you could always use an image. Once again it's not exactly the same, but it's possible.
And then there is always my sneeky way:
VB Code:
With Label5 .AutoSize = True .Text = "___________" .ForeColor = System.Drawing.Color.Red End With
So if I want to draw a line diagonally, I'll have to use the GDI+ thing? (Of course, I could always use bunch of /'s. :D )
Here you go, try something like this to get your line:
VB Code:
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint Dim gr As Graphics Dim pen As Pen pen = New Pen(System.Drawing.Color.Black) pen.Width = 5 gr = e.Graphics gr.DrawLine(pen, 10, 10, 200, 200) End Sub
In my programs it turned into a 1 pixel high Panel. :D