CFont * f; // Establece la fuente, nueva en el constructor
(2) Crear fuentes (incluyendo tamaño y estilo de fuente)
f-> CreateFont (30, 10, 0, 0, 700, FALSE, FALSE, 0, DEFAULT_CHARSET, DEFAULT_CHARSET,
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SCRIPT, "黑体");
(3) Seleccione el control para modificar la fuente
GetDlgItem (IDC_BUTTON1) -> SetFont (f);
GetDlgItem (IDC_STATIC_INPUT) -> SetFont (f);
GetDlgItem (IDC_EDIT_COR_NUM) -> SetFont (f);
2 Control de color de fuente y color de fondo:
(1) Crear una variable de color
COLORREF m_colorEditText; // Editar color de fuente de control
COLORREF m_colorEditBK; // El color de fondo del control de edición
(2) Haga clic derecho en el espacio en blanco de la interfaz, agregue la función de mensaje OnCtlColor y agregue el siguiente código:
(3) Si desea cambiar dinámicamente, modifique la variable de color en el lugar que causó el cambio (como en la función del botón) y luego llame a tres funciones:
dlg1-> m_colorEditBK = RGB (0, 255, 0); // Fondo verde
dlg1-> m_colorEditText = RGB (0, 0, 0); // fuente negro
dlg1-> GetDlgItem (IDC_EDIT_DISPLAY1) -> SetRedraw (TRUE);
dlg1-> GetDlgItem (IDC_EDIT_DISPLAY1) -> Invalidate ();