Red de conocimiento informático - Material del sitio web - Cómo configurar la fuente y el tamaño del texto de salida en vc

Cómo configurar la fuente y el tamaño del texto de salida en vc

Primero debes usar CreateFont para crear un objeto de fuente y luego llamar a SetFont del control. Eso es todo.

Ejemplo:

1. Cambie el ID del estilo estático, como por ejemplo: IDC_STATIC1

2. Agregue un control de edición y cree un control asociado m_editControl.

3. Agregue el siguiente código a OnInitDialog: CFont?*?f;

f?=?new?CFont;

f->CreateFont(

16,?//?nAltura 0,?//?nAncho 0,?//?nEscape 0,?//?nOrientación FW_BOLD,//?nPeso TRUE,?//?bCursiva FALSE,? //?bSubrayado 0,?//?cStrikeOut ANSI_CHARSET,?//?nCharSet OUT_DEFAULT_PRECIS,//?nOutPrecision CLIP_DEFAULT_PRECIS,//?nClipPrecision DEFAULT_QUALITY,//?nCalidad DEFAULT_PITCH?|?FF_SWISS,?//?nPitchAndFamily _T(" Arial")//?lpszFac );?

m_editControl.SetFont(f);

m_editControl.SetWindowText("xxxxxx");

GetDlgItem_r(IDC_STATIC1 )->SetFont(f);