Draw Line

Posted on 2005-04-09
Last Modified: 2006-11-18

How I can draw line or Rectangle with form designer without writing any code ?

Thank you.
Question by:mr60
    LVL 20

    Accepted Solution

    It's not possible in C#
    LVL 8

    Expert Comment


    Maybe a Panel with border will help you.

    LVL 20

    Expert Comment

    A panel with border would be drawn in a different way on different OS (Win2k, WinXP, WinME): sometimes blue, sometimes black.... So it's not very trustworthy
    LVL 21

    Expert Comment

    use a picture box with border.

    for a 3d horizontal line, set the border to Fixed3D and set the height to 4 (and the length to whatever you want to)
    for a 2d thick horizontal line, set the border to FixedSingle and set the height to 2 (...)
    for a 2d thin hor line, set the border to FixedSingle and set the height to 1

    for 3d vertical line, set the border to Fixed3D and set the width to 4 (and the length to whatever you want to)
    follow the pattern above...

    to draw a rectangle, use a picture box with FixedSingle border. The border colour of the rect will be always black - no way to change, the background colour is changable. The colour of the thick 2d line can be changed as well - set border to none, height to more than 1 and set the background to the colour of your preference.

    LVL 96

    Expert Comment

    by:Bob Learned
    All very clever responses :)

    LVL 1

    Author Comment

    By Visual Basic 6 ,programmer can draw lines on form.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Article by: Ivo
    C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now