Results 1 to 8 of 8

Thread: Where'd the line control go?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Posts
    210

    Where'd the line control go?

    I don't see any line controls...
    How would I draw a line without using a code?

  2. #2
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    You can use the label control. Set the width to 2 and set the borderstyle to single, then make the lenght whatever you want.
    Dont gain the world and lose your soul

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Posts
    210
    That's a funny way to do it
    So there isn't a way to use a color for that "line" or change the width of the line?

  4. #4
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    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
    Dont gain the world and lose your soul

  5. #5
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277

    Thumbs up

    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:
    1. With Label5
    2.     .AutoSize = True
    3.     .Text = "___________"
    4.     .ForeColor = System.Drawing.Color.Red
    5. End With
    ~Peter


  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Posts
    210
    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. )

  7. #7
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Here you go, try something like this to get your line:
    VB Code:
    1. Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
    2.         Dim gr As Graphics
    3.         Dim pen As Pen
    4.         pen = New Pen(System.Drawing.Color.Black)
    5.         pen.Width = 5
    6.         gr = e.Graphics
    7.         gr.DrawLine(pen, 10, 10, 200, 200)
    8.     End Sub

  8. #8
    Addicted Member mralston's Avatar
    Join Date
    Aug 2002
    Location
    Altrincham Nr Manchester, England
    Posts
    141
    In my programs it turned into a 1 pixel high Panel.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width