Known a dialog box, the button in the dialog box bring up another dialog box Dlg1, how to change the Dlg1 static text font size? There is no the Oninit function Dlg1. CPP
CodePudding user response:
The class CDlg1Dlg: public CDialog
{
CFont m_BigFont;
};
BOOL CDlg1Dlg: : OnInitDialog ()
{
__super: : OnInitDialog ();
M_BigFont. DeleteObject ();
M_BigFont. CreatePointFont (240, _T (" Arial "));
If (GetDlgItem (IDC_STATIC2))
{
GetDlgItem (IDC_STATIC2) - & gt; The SetFont (& amp; M_BigFont);
}
return TRUE;
}
CodePudding user response:
m_fontbase. CreateFont ( 14,//nHeight 7,//nWidth 0,//nEscapement 0,//nOrientation FW_NORMAL,//nWeight FALSE,//bItalic FALSE,//bUnderline 0,//cStrikeOut ANSI_CHARSET,//nCharSet OUT_DEFAULT_PRECIS,//nOutPrecision CLIP_DEFAULT_PRECIS,//nClipPrecision DEFAULT_QUALITY,//nQuality DEFAULT_PITCH | FF_SWISS,//nPitchAndFamily L "tahoma"); Pstatic - & gt; The SetFont (& amp; M_fontbase); Pay attention to the Font is defined as member variables
CodePudding user response:
No OnInitDialog this function, in the.cpp file is through a new dialog box in the dialog box button calls out the static text
CodePudding user response:
reference 1st floor zgl7903 response: class CDlg1Dlg: public CDialog { CFont m_BigFont; }; BOOL CDlg1Dlg: : OnInitDialog () { __super: : OnInitDialog (); M_BigFont. DeleteObject (); M_BigFont. CreatePointFont (240, _T (" Arial ")); If (GetDlgItem (IDC_STATIC2)) { GetDlgItem (IDC_STATIC2) - & gt; The SetFont (& amp; M_BigFont); } return TRUE; } No OnInitDialog this function, in the.cpp file is through a new dialog box in the dialog box button calls out the static text CodePudding user response:
refer to the second floor marslycan response: m_fontbase. CreateFont ( 14,//nHeight 7,//nWidth 0,//nEscapement 0,//nOrientation FW_NORMAL,//nWeight FALSE,//bItalic FALSE,//bUnderline 0,//cStrikeOut ANSI_CHARSET,//nCharSet OUT_DEFAULT_PRECIS,//nOutPrecision CLIP_DEFAULT_PRECIS,//nClipPrecision DEFAULT_QUALITY,//nQuality DEFAULT_PITCH | FF_SWISS,//nPitchAndFamily L "tahoma"); Pstatic - & gt; The SetFont (& amp; M_fontbase); Note that the Font is defined as a member variable Where is this code written in the book? CodePudding user response:
reference 4 floor three-legged monster reply: CPP file without OnInitDialog the function, is through a new dialog box in the dialog box button calls out the static text Overloading OnInitDialog CodePudding user response:
The CWnd: : SetFont (); CodePudding user response:
Well, it seems that is just started to play