[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

horizontal line in c# forms

Posted on 2006-03-24
8
Medium Priority
?
3,116 Views
Last Modified: 2012-06-27
Hey all,

A real basic question I presume. I simply want to draw horizontal lines on my forms for formatting and neatness on my GUI.

I got the drawing toolbar up, but it is always greyed out.

Suggestions?

Thanks.
0
Comment
Question by:Dodger42
8 Comments
 
LVL 28

Expert Comment

by:strickdd
ID: 16285330
You could draw a picture box and set the background color to black if you want... That's the best thing I can think of right now, but I'll look more into it.
0
 
LVL 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 60 total points
ID: 16285719
You can use a Label with a Height of 1 and the BorderStyle set to FixedSingle.
0
 

Author Comment

by:Dodger42
ID: 16286791
Thanks IM, that is close, but its quite clunky. Grabbing and dragging the flattened label is akward. Surely there is another way. In vs2005, if you go to options, you can see the sort of horizontal line I mean above the OK, Cancel buttons.

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 16287088
I know it's clunky and a pain in the arse to move around...

Unfortunately there just isn't a plain old line control included in .Net!

Sorry...
0
 
LVL 6

Accepted Solution

by:
e1v earned 140 total points
ID: 16308403
You could make your own usercontrol, or you can head over to www.codeproject.com and search for "Line control", where several people has made simple line controls. (you have to be registered there (free) to download source)

This one: http://www.codeproject.com/cs/miscctrl/NiceLine.asp works fine I think, it didn't compile in vs 2005 but it was only one line that had to be changed (add a cast to double)
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16311958
You can draw lines in the Paint event using GDI+, but that may be just as "clunky".

Bob
0
 

Author Comment

by:Dodger42
ID: 16347399
Thanks all. I guess there are several answers which get a solution. I'm shocked given the frequent use of lines in forms, that MS havent included a control even after all these years of forms design.

0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 16347489
So am I.  =)

The lowly VB6 had a line control (also a rectangle and ellipse control wrapped in a Shape control) that many people miss after moving to VB.Net
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Integration Management Part 2
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

873 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