1. Change the font size and style of the control.
Cfont m_lfont;
Void XX: changelistfontsize (void)
{
M_lfont.createfont (
25, // nheight
0, // nwidth
0, // nescapement
0, // norientation
// Fw_normal, // nweight
Fw_medium,
// Fw_semibold,
False, // bitalic
False, // bunderline
0, // cstrikeout
// Ansi_charset,
Default_charset, // ncharset
Out_default_precis, // noutprecision
Clip_default_precis, // nclipprecision
Default_quality, // nquality
Default_pitch | ff_swiss, // npitchandfamily
_ T (" "));
Getdlgitem (idc_list_music)-> setfont (& m_lfont );
Getdlgitem (idc_static_music)-> setfont (& m_lfont );
}
2. Change the font size and style of the header in listctrl.
Cfont m_hfont;
Void XX: changepricelistheadfontsize (void)
{
M_hfont.createfont (
18, // nheight
0, // nwidth
0, // nescapement
0, // norientation
Fw_normal, // nweight
// Fw_medium,
// Fw_semibold,
False, // bitalic
False, // bunderline
0, // cstrikeout
// Ansi_charset,
Default_charset, // ncharset
Out_default_precis, // noutprecision
Clip_default_precis, // nclipprecision
Default_quality, // nquality
Default_pitch | ff_swiss, // npitchandfamily
_ T (" "));
Cheaderctrl * pheaderctrl = m_pricelist.getheaderctrl ();
Pheaderctrl-> setfont (& m_hfont );
}
3. Change the background color of the form, static box, edit box, And listctrl.
Cbrush m_brush;
In initialization:
Getparentframe ()-> recalclayout ();
M_brush.createsolidbrush (RGB (140,20, 15 ));
Override onctlcolor
Hbrush XX: onctlcolor (CDC * PDC, cwnd * pwnd, uint nctlcolor)
{
Hbrush HBr = cformview: onctlcolor (PDC, pwnd, nctlcolor );
// Todo: change any attributes of the DC here
If (nctlcolor = ctlcolor_edit)
{
If (pwnd = getdlgitem (idc_edt_text) | pwnd = getdlgitem (idc_edt_price ))
{
PDC-> settextcolor (RGB (255,255,255 ));
PDC-> setbkmode (transparent); // set the background to transparent
}
}
If (nctlcolor = ctlcolor_static)
{
PDC-> settextcolor (RGB (255,255,255 ));
Hbrush hnullbr = (hbrush): getstockobject (null_brush );
PDC-> setbkmode (transparent); // set the background to transparent
Return hnullbr;
}
// Todo: return a different brush if the default is not desired
Return m_brush;
}