ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Removed Areas > C / C++

Static Text Control Font Size

<< < (2/2)

Eóin:
I don't really know with MFC but you probably have to Attach the CWnd class you're creating to the existing Dialog control. Honestly though I'm not sure.

Davidtheo:
Hi,

I got it to build. I did it by adding a control variable called C_word to the Static text control and the removing the following two lines and adding this one.


--- Code: C++ ---//CWnd *wndControl  = GetDlgItem(IDC_Word);//wndControl.SetFont(font_fixedw_,TRUE); C_Word.SetFont(&font_fixedw_);
However are text does not seem to get bigger.
I will keep playing with it.

Thanks for your Help.

Davidtheo:
Hi Again

Just to let you know I did it in three lines of code.


--- Code: C++ ---CFont *m_Word = new CFont;m_Word->CreatePointFont(600, _T("Arial") );C_Word.SetFont(m_Word); //C_Word is a control variable for the Static text control
I thought there is a easy way to do it just did not know how, Thanks again for your help.

tez93:

I was trying to work out how to do this myself recently and came up with another method as Visual Studio didn't seem to want to let me create a control variable for a static text control within a dialog.


--- Code: C++ ---CFont* g_hFont = NULL; ... case WM_INITDIALOG:{        if (g_hFont)        {                delete g_hFont;                g_hFont = NULL;        }         g_hFont = new CFont;        g_hFont->CreatePointFont(140, _T("Verdana"));        CWnd::FromHandle(GetDlgItem(hDlg, IDC_STATIC_NAME))->SetFont(g_hFont, TRUE);         return (INT_PTR)TRUE;} ...

Navigation

[0] Message Index

[*] Previous page

Go to full version