someguy
someguy

Reputation: 7334

How do I draw separators?

I am programming in C, using the Windows API, and would like to know how I could draw separators. I would appreciate a code example.

Edit: Here's an illustration.

alt text
(source: microsoft.com)

Upvotes: 9

Views: 5195

Answers (4)

Anders
Anders

Reputation: 101736

Use a static control/window with the SS_ETCHEDHORZ style (This is what explorer does and should give you the most accurate rendering when it comes to Visual Styles)

Upvotes: 8

Andreas Rejbrand
Andreas Rejbrand

Reputation: 109002

OK, you just want to draw straight lines on the form. That is trivial. When drawing your window, i.e. when processing the WM_PAINT message, simply draw a line using the MoveToEx and LineTo functions.

Upvotes: 2

Terry Mahaffey
Terry Mahaffey

Reputation: 11981

I don't suppose you're just looking for LineTo?

For menus and toolbars, generally the separators are drawn for you by the menu and toolbar APIs. For random separators in dialog boxes, etc, like in the picture you added you can just draw a line.

Upvotes: 2

codymanix
codymanix

Reputation: 29490

You insert separators in menus when you insert a normal menu item with a hyphen "-" as text.

Windows will automatically expand them to separators.

Upvotes: 0

Related Questions