Click here to Skip to main content
15,892,298 members
Articles / Programming Languages / C#
Article

Simple Bevel Control

Rate me:
Please Sign up or sign in to vote.
3.94/5 (19 votes)
26 Jan 2007CPOL 54.3K   810   24   10
A simple control for visually grouping controls with edges / bevels
Sample Image - bevelcontrol.jpg

Introduction

Recently, I ran into the problem of grouping components visually. I wasn't satisfied with panels and groupboxes so I searched for an alternative. After some Googling, I decided to write a simple control by myself.

Background

"Good ol' Delphi" provided a nifty component called TBevel for visually grouping controls. It's not a container and acts only like a "spacer".

Controls like this are often used to divide buttons at the bottom of a form from the others above. Take a look at the "OK" and "Cancel" buttons in the screen shot. They are visually grouped together and divided from the rest.

Using the code

Provided are four additional properties:

BevelStylePossible values:
C#
public enum BevelStyle
{
  Lowered,
  Raised
}
BevelTypePossible values:
C#
public enum BevelType 
{
  Box, 
  Frame, 
  TopLine, 
  BottomLine, 
  LeftLine,
  RightLine, 
  Spacer                        
}
HighlightColorPossible values:
any Color
ShadowColorPossible values:
any Color

Points of Interest

Well, there are none... It's just a simple graphical control. Nothing special - but definitely a "nice to have".

There is only one thing I could mention here: The value BevelType.Spacer displays a dotted rect around the control only at designtime.

History

  • 26th January, 2007: Initial release

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralArtifacts when resizing Pin
Joshua Graffman6-Nov-09 9:51
Joshua Graffman6-Nov-09 9:51 
GeneralVery Nice Pin
sunnyandy27-Sep-08 9:06
sunnyandy27-Sep-08 9:06 
QuestionHow about ControlPaint Pin
Oleg A.Lukin29-Jan-07 22:37
Oleg A.Lukin29-Jan-07 22:37 
AnswerRe: How about ControlPaint Pin
OlliFromTor29-Jan-07 23:07
OlliFromTor29-Jan-07 23:07 
GeneralToolbox Pin
fraveu29-Jan-07 7:51
fraveu29-Jan-07 7:51 
GeneralRe: Toolbox Pin
OlliFromTor29-Jan-07 21:45
OlliFromTor29-Jan-07 21:45 
GeneralRe: Toolbox [modified] Pin
fraveu30-Jan-07 2:48
fraveu30-Jan-07 2:48 
GeneralExcellent Pin
Patrick Etc.26-Jan-07 9:47
Patrick Etc.26-Jan-07 9:47 
GeneralNice Pin
ricmil4226-Jan-07 7:25
ricmil4226-Jan-07 7:25 
GeneralRe: Nice Pin
Ilíon29-Jan-07 5:18
Ilíon29-Jan-07 5:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.