U
Du musst sicherstellen, dass der Font solange erhalten bleibt, wie die Buttons vorhanden sind. Also besser als Member-Variable in den Dialog:
class CMyDialog : public CDialog
{
...
CFont m_font;
...
};
Dann in OnInitDialog():
[cpp]LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT)); // zero out structure
strcpy(lf.lfFaceName, "Arial");
// Schriftdicke
lf.lfWeight = FW_BOLD;
// Schriftgröße
lf.lfHeight = 20;
// font erstellen
VERIFY(m_font.CreateFontIndirect(&lf));
// Font setzen
//CFont old_font = dc->SelectObject(&font); nicht nötig*
// Schrift für Editfeld und Button einstellen
m_editfeld_1.SetFont(&m_font);
m_button_Quittieren.SetFont(&m_font);
// Beschriftung des Buttons
m_button_Quittieren.SetWindowText("Test"); [/cpp]