Results 1 to 7 of 7

Thread: How to create a small line in GUI?

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2006
    Posts
    9

    How to create a small line in GUI?

    Hi, I am working on an assignment for my VB.Net class, and our instructor presented us with a screenshot of what the form we have created should look like when finished. The exercise is geared more toward creating group boxes, learning layout and controls...those sorts of things, and I think I've added everything, EXCEPT...the screenshot shows a small black line in between the group boxes and a label with some text in it. I just can't figure out how to create this thin line. I suppose it could be an image, but I'm not sure. Can anyone help me out? I've attached a doc with the image so that you can see what I'm talking about. Thanks for any and all help! Geaux noobs!

    Attached Files Attached Files

  2. #2
    Fanatic Member
    Join Date
    May 2001
    Posts
    837

    Re: How to create a small line in GUI?

    Could that be a screenshot from a VB6 program that the instructor used before the course for VB.NET was created? VB6 had a line control, but .NET does not. If you really want a line you can do it with a single line of code.
    The human brain cannot hold all of the knowledge that exists in this world, but it can hold pointers to that knowledge.

  3. #3
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: How to create a small line in GUI?


  4. #4
    Fanatic Member
    Join Date
    May 2001
    Posts
    837

    Re: How to create a small line in GUI?

    The easiest way is to handle the Paint event and write e.Graphics.DrawLine(0, 150, Me.Size.Width, 150), replacing 150 with whatever height you need.
    The human brain cannot hold all of the knowledge that exists in this world, but it can hold pointers to that knowledge.

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: How to create a small line in GUI?

    That looks like a VB 6 Form. If your using VB 6 then you can use the line control. If your using VB.NET then either use GDI+ like already posted or easier, use a label with a black background with a height of 1 pixel.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840

    Re: How to create a small line in GUI?

    Make a label with borderstyle set to either 3D or single, and make the height of the label 2 pixels and the width to match the width of the form.

    EDIT: damn you Rob....
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

  7. #7

    Thread Starter
    New Member
    Join Date
    Aug 2006
    Posts
    9

    Re: How to create a small line in GUI?

    Thanks very much, everyone!

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