Click here to Skip to main content
15,797,052 members
Articles / Desktop Programming / MFC

A bevelline with horizontal and vertical text

Rate me:
Please Sign up or sign in to vote.
4.94/5 (9 votes)
9 Jan 2000 91.4K   2.6K   40   10
A bevelline control that displays vertical and horizontal text
  • Download demo project - 52 Kb
  • Download source files - 30 Kb
  • The class described here replaces a previous class I wrote, and supercedes Michael Dunn's extension to my class.

    This class provides the following options:


    • A bevel line even if user has strange fonts
      (have you ever created a sunken static with a height of 1 for a bevelline and tested your program on a machine that has 200% larger fonts ?).
    • Text rotates appropiately (usable with any font).
    • Reacts properly on WM_ENABLEWINDOW.
    • Might be used as an example for my cdxCRot90DC (which you may find in the GDI section).

    How to use (in a dialog):

    1. Add cdxCRotBevelLine.h, cdxCRotBevelLine.cpp, cdxCRot90DC.h and cdxCRot90DC.cpp to your project.
    2. Add a static control to your dialog resource.
      Enter some appropiate text to it.
      If your static's width is greater than its height the bevelline will appear horizontal, vertical otherwise.
      If the bevelline is drawn vertically, the text is rotated by 90° degrees by default (left hand examples of upper image).
      To modify this, put a "~" in front of your control text (right hand bevels in the upper image).
    3. Change its ID to something like IDC_BEVEL_1, open classwizard and assign a member variable, type control (CStatic) to it (m_wndBevel1 for example).
    4. Open your dialog class' header file.
      Add #include "cdxCRotBevelLine.h".
      Find the line CStatic m_wndBevel1 and replace the CStatic by cdxCRotBevelLine.
    5. Compile and run.


    • This class may even be useful to you if you only need horizontal bevels.
      Some people mentioned that it's enough to create a sunken static with a height of 1 (use Alt while sizing the control) and to put another text control over it.
      In fact, this will look really strange if the user choosed big fonts for his display - the dialog resource will automatically adapt the the newly found font and your height of 1 may become 3 or stuff - and suddenly friend user doesn't have a bevelline but a sunken static.


    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here

    Written By
    Other JP Morgan Chase
    Hong Kong Hong Kong
    This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

    Comments and Discussions

    Question¡GENIAL! Pin
    pamopamo15-Feb-21 22:40
    pamopamo15-Feb-21 22:40 
    QuestionLicense Type? Pin
    Member 1325386410-Dec-18 19:52
    Member 1325386410-Dec-18 19:52 
    GeneralExcellent! Pin
    Chris Hills28-Nov-07 13:14
    Chris Hills28-Nov-07 13:14 
    This is the best type of CodeProject article - you use it, and it just works. Rose | [Rose]
    Generalgood job [modified] Pin
    Dr.Luiji4-Feb-07 9:00
    professionalDr.Luiji4-Feb-07 9:00 
    QuestionNon-dialog usage ? Pin
    Paul Sujkov21-Feb-06 0:36
    Paul Sujkov21-Feb-06 0:36 
    GeneralUsing static control Pin
    Andrew Peace4-Sep-01 15:55
    Andrew Peace4-Sep-01 15:55 
    GeneralAdding tooltip Pin
    19-Aug-01 0:07
    suss19-Aug-01 0:07 
    GeneralRe: Adding tooltip Pin
    20-Aug-01 7:32
    suss20-Aug-01 7:32 
    GeneralRe: Adding tooltip Pin
    Roger Allen4-Jan-02 5:36
    Roger Allen4-Jan-02 5:36 
    GeneralUsing this control Pin
    Matthew LeRay9-Jun-00 5:03
    sussMatthew LeRay9-Jun-00 5:03 

    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.