Compartir a través de


COleControl::OnFontChanged

Llamado por el marco cuando el valor de propiedad de fuente común ha cambiado.

virtual void OnFontChanged( );

Comentarios

La implementación predeterminada llama a COleControl::InvalidateControl.si el control está creando subclases un control de Windows, la implementación predeterminada también envía un mensaje de WM_SETFONT a la ventana de control.

Invalide esta función si desea que la notificación cuando cambie de esta propiedad.

Ejemplo

void CMyAxCtrl::OnFontChanged()
{
   // Always set it to the container's font
   if (m_MyEdit.m_hWnd != NULL)
   {
      IFontDisp* pFontDisp = NULL;
      IFont *pFont = NULL;
      HRESULT hr;

      // Get the container's FontDisp interface
      pFontDisp = AmbientFont();
      if (pFontDisp)
      {
         hr = pFontDisp->QueryInterface(IID_IFont, (LPVOID *) &pFont);
         if (FAILED(hr))
         {
            pFontDisp->Release();
            return;
         }
      }

      HFONT hFont = NULL;
      if (pFont)
      {
         pFont->get_hFont(&hFont);
         m_MyEdit.SendMessage(WM_SETFONT, (WPARAM)hFont, 0L);
      }

      pFontDisp->Release();
   }

   // Invalidate the control
   m_MyEdit.Invalidate();
   m_MyEdit.UpdateWindow();

   COleControl::OnFontChanged();
}

Requisitos

encabezado: afxctl.h

Vea también

Referencia

Clase de COleControl

Gráfico de jerarquía

COleControl::GetFont

COleControl::InternalGetFont

COleControl::InvalidateControl