I came accross a fancy font selection box the other day. It was so cool I thought I'd copy the idea.
Its basically an imitation of the font selection box found in MS Word, it has an MRU font list and the other cool feature is that it has a Tooltip window showing the currently selected font name displayed using the selected font. This gives the user a sample of what the font is going to look like without actually making a selection.
The main component is an ownerdraw combo with has strings flags set, the combo isn't sorted because the Most Recently Used font are at the top of the combo.
The combo is called CFontCombo it is simple to use in dialog boxes, just follow this simple instructions.
- Copy "FontCombo.h" and "TipWnd.h" to your project directory.
- Add the files to your project.
- Copy the "Printer.bmp" to your project "res" directory.
- #include "FontCombo.h" and "TipWnd.h" to the header file of your dialog class or to the "stdafx.h"
- Using the resource studio Import the printer.bmp and name it IDB_GLYPHS
- Using the dialog editor create your combo box and give it the following styles: "DropDown", Fixed, "Has Strings", and Verticle Scroll .
- Edit the dialogs class header file replace "CComboBox" for CFontCombo
- In OnInitDialog before the return statement Add the following line
Files and resources needed to be included into you own project:
FontCombo.h & cpp
TipWnd.h & cpp,
IDB_GLYPH bitmap resource