Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

How do you dynamically change the font size at runtime in a ATL dialog?

$
0
0

I need to change the font size in my ATL dialog templates at runtime (so that the entire dialog gets rescaled).  What is the best approach to do this?  The only solution I've found in the forums does this in a MFC project by modifying the dialog template.  I've looked at the MFC source but it does not seem to be an easy task to port it to ATL for my own use.  Here is the MFC code:

INT_PTR MyDlg::DoModal()
{
   CDialogTemplate dlt;
   int             nResult;
   if (!dlt.Load(MAKEINTRESOURCE(MyDlg::IDD)))
     return -1;
   dlt.SetFont("MS Sans Serif", 13);
   LPSTR pdata = (LPSTR)GlobalLock(dlt.m_hTemplate);
   m_lpszTemplateName = NULL;
   InitModalIndirect(pdata);
   nResult = CDialog::DoModal();
   GlobalUnlock(dlt.m_hTemplate);
   return nResult;
}

Does anyone have an example of how to do this with ATL?


AliciaV


Viewing all articles
Browse latest Browse all 15302

Trending Articles