hello,

I'm happy to participate in this forum and this is my first post.
our instructor gave us an assignment to design an id using C# windows application and i don' know how to put vertical line using label or any thing

thanks in advance

Could you clarify what you mean by an id? Do you mean something like an Identification Card?
There are a number of ways to present a line on the screen, but which one you use depends on what you are trying to acheive.
You can use Paint methods to draw directly to the form or a control, or you can use an image to show a picture of a line, or you can use a control which has a border or even a split panel.
If you can clarify your goals, i can narrow down the best tool for the job :)

Welcome annaqah.

Handle Paint event of Form and use GDI classes to draw a vertical line onto the Form.

private void Form1_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.DrawLine(Pens.Blue, 10, 10, 10, 200);
        }
Comments
You seem to have an understanding of what some posters can't express very well in English.

yes it's an identification card and there are two lines one vertical and the other is horizontal
the horizontal on the top of the picture to split (picture and info's) and logo

and the vertical to split picture and info's

so i had plotted the horizontal line using a lot of underscores in label

but the vertical one i couldn't even couldn't to rotate the label itself

thanks for all

thank you adatapost for the method and we had learned it but i would like to keep it like labels and textboxes because it's early for coding
but i will try it now

thanks for all of you..

Edited 7 Years Ago by annaqah: n/a

about the method it says PaintEventArgs couldn't be found in

private void Form1_Paint(object sender, PaintEventArgs e)

So go in design mode, click on the Form and select the lightning bolt icon in the properties window. You see a list of all the event available for the form. Select the Paint event and double click it. In the event handler fill in the code proposed by adatapost(just line 3 of his code of course)

Comments
helpful!
This article has been dead for over six months. Start a new discussion instead.