Virtual Developer Workshop: Containerized Development with Docker
Environment: VC6 SP4, NT4 SP3
I needed a control to choose a character from a specific charset and the options to use bold and/or italic font. Therefore I derived an ownerdrawn control from CButton based on the work of Shekar Narayanan and S. D. Rajan which opens a popup dialog as a drop-down window. The Dialog itself holds a ComboBox derived font-ComboBox (which includes some code-snippets of Norm Almond) and a custom control which performs the character selection.
- Import the header files (including in the attached source code) and add the .cpp files (also attached to this article) from the section CharSetBtn.
- Import the resources IDB_GLYPHS (printer-images) and IDD_CHARSET_DLG (the popup-window including the CharSetCtrl).
- On your dialog insert a button (set style-flag ownerdraw).
- Add a CButton control-member-variable in the class-wizard. Change the CButton class in the dialog-header-file to CCharSetBtn and that's it.
The class CCharSetBtn has got the member-variables
int m_nChar; CString m_strFaceName; BOOL m_bItalic; BOOL m_bBold;
which perform the data-exchange.
With a little modification you can also use the complete LOFGONT structure.
If you decide to use this code please do not remove copyright notices from the source and header files and give me a short e-mail.
DownloadsDownload demo project - 40 Kb
Download source - 29 Kb