Click here to Skip to main content
13,355,726 members (58,922 online)
Click here to Skip to main content
Add your own
alternative version


43 bookmarked
Posted 9 Jan 2000

CStatic-derived histogram control

, 9 Jan 2000
Rate this:
Please Sign up or sign in to vote.
A simple histogram control for displaying data
  • Download demo project - 20 Kb
  • Download source files - 2 Kb
  • Sample Image - alexf_histogram.jpg

    <!-- Article Starts -->

    The CAlexfStaticHistogram control is a lightweight class suitable for displaying histograms. You can add new columns, additional text, change text orientation and direction of motion (if you change data at runtime).

    Using CAlexfStaticHistogram in a dialog is quite simple:

    1. Include CAlexfStaticHistogram.h in your dialog class' header file.
    2. Add member variables of type CAlexfStaticHistogram for every static text control you want to subclass.
    3. Subclass the static text controls in your dialog's OnInitDialog() method and set the controls' style.
    m_sHistogram.SetTextWidth(50); // Set text width (0 - no text)
    m_sHistogram.SetTextLines(5);  // Set number of text lines (0 - none)
    m_sHistogram.text[0] = "Z1";   // Set text (too easy to create special
    m_sHistogram.text[1] = "Zz2";  // function for that)
    // ...
    m_sHistogram.SetMaxValue(99.9) // Set relatival maximum
    m_sHistogram.Add(50);          // Add new column to histogram

    If you want "dynamic" histogram - you can owerride, for example, OnTimer() and simply call:


    Please feel free to send me any suggestions about this control.


    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


    About the Author

    Alexander Fedorov
    Web Developer SEO
    Russian Federation Russian Federation
    AlexF's Blog in Russian
    Owner Spy competition analysis
    Rating Burner Rating of blogs

    You may also be interested in...


    Comments and Discussions

    GeneralCode update Pin
    Fred Ackers15-Oct-06 13:32
    memberFred Ackers15-Oct-06 13:32 
    GeneralNice article Pin
    Georgi Petrov31-Jul-06 3:23
    memberGeorgi Petrov31-Jul-06 3:23 

    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.

    Permalink | Advertise | Privacy | Terms of Use | Mobile
    Web04 | 2.8.180111.1 | Last Updated 10 Jan 2000
    Article Copyright 2000 by Alexander Fedorov
    Everything else Copyright © CodeProject, 1999-2018
    Layout: fixed | fluid