This article was contributed by Michel Wassink.
This article presents a CStatic derived class for displaying numbers or text like a LED Display. This control does not use bitmaps. Everything is drawn with lines and Bezier curves. First I made some classes to draw a character, which consists of segments that can be any closed shape, by only giving some points. The points can be connected by lines or by Bezier curves to make nice smoothened characters. The theory of fitting Bezier curves can be found in bezdist.pdf, created by Jim Fitzsimmons, in my demo project cabinet. The CDigistring resizes itself automatically, which can be experienced with the demo app, wherefore I used the resizing dialog code from Hans Bühler.
To to design the characters I looked around for different styles. The most inspiration came out of my car. I used characters from the date/time/temperature display and from my RDS-radio. 14- And 7-segment displays in straight and smooth style are supported and one common character for displaying a decimal point or a colon. I changed the designs a lot to get aesthetically best results, but I didn't went crazy by changing all the points every time because I do some nifty mirrorring for most of the segments. For example i only specified 5 segments for the 14 segment display.
You can modify these if you like, then you can take them over to the source the same way as I did. The height of every design is the same only the width may be different, necessary for easy scaling.
BOOL ModifyDigiStyle(DWORD dwRemove, DWORD dwAdd);
With the MidifyDigiStyle function you can add or remove specific CDigistring styles. The styles, which can be combined by using the bitwise OR (|) operator, are:
CDigistring::DS_SMOOTH // Smooth kind of characters CDigistring::DS_STYLE14 // use always 14 segment display. CDigistring::DS_SZ_PROP // size proportional(default)
Add Comment
INSTANT EXPERTS!Savvy IT Pros report on SupportSource. Take a look inside the largest vault of multi-vendor computing specs ever assembled. Click here for an In-depth Report,. Learn about Free & Open Source software at the Bazaar Conference & Expo!,December 14-16, 1999 in New York City! Click here for more information. For tons of Windows technology resources, check out the Windows Programming directory. Go to Fatbrain for the NEWEST and BEST technical books for IT professionals. Get Linux Utilities for ONLY $34.95 at EarthWeb Direct.