1

Topic: The type size in CStatic does not increase

I created inscription IDC_STATIC1 of type CStatic to which there corresponds a variable m_IDC_STATIC1 on a dialog box. I want to increase type size in this element. For this purpose I wrote the code as OnInitDialog: memset (&lf,0,sizeof (lf)); lf.lfHeight = 30; lf.lfWidth = 10; lf.lfWeight = FW_NORMAL; lf.lfCharSet = ANSI_CHARSET; lf.lfOutPrecision = OUT_DEFAULT_PRECIS; lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; lf.lfQuality = PROOF_QUALITY; lf.lfPitchAndFamily = VARIABLE_PITCH | FF_ROMAN; wcscpy (lf.lfFaceName, L "MS Sans Serif"); font1.CreateFontIndirectW (&lf); m_IDC_STATIC1.SetFont (&font1); but at me for some reason the type size remains former - what was. I tried to solve a problem in another way - created class CMyStatic which is the descendant of class CStatic in which I redefined method OnPaint: int CMyStatic:: OnPaint () {CString mystr; LOGFONT lf; CFont ft; CDC *pDC = this-> GetDC (); this-> GetWindowTextW (mystr); memset (&lf,0,sizeof (lf)); lf.lfHeight = 30; lf.lfWidth = 10; lf.lfWeight = FW_NORMAL; lf.lfCharSet = ANSI_CHARSET; lf.lfOutPrecision = OUT_DEFAULT_PRECIS; lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; lf.lfQuality = PROOF_QUALITY; lf.lfPitchAndFamily = VARIABLE_PITCH | FF_ROMAN; wcscpy (lf.lfFaceName, L "MS Sans Serif"); ft. CreateFontIndirectW (&lf); pDC-> SelectObject (&ft); pDC-> TextOutW (0,0, mystr); return 0;} and as OnInitDialog I instead of the code resulted above (in the beginning of my message), wrote: m_IDC_STATIC1.RedrawWindow (); However and in this case the same result - type size does not increase. What it is necessary to make to solve this problem - that the font in this component m_IDC_STATIC1 increased both on height, and on width?

2

Re: The type size in CStatic does not increase

https://social.msdn.microsoft.com/Forum … m=vcmfcatl

3

Re: The type size in CStatic does not increase

Hello, SNNy, you wrote: , yet really MFC still such oak, what it becomes not through the designer, and through the code? ...

4

Re: The type size in CStatic does not increase

Hello, Amygdala, you wrote: A> Hello, SNNy, you wrote: A> Bliin, yet really MFC still such oak, what it becomes not through the designer, and through the code? ... And FC the Microsoft practically does not develop, it same as well as many years ago.

5

Re: The type size in CStatic does not increase

Hello, RussianFellow, you wrote: RF> However and in this case the same result - the type size does not increase. RF> that it is necessary to make to solve this problem - that the font in this component m_IDC_STATIC1 increased both on height, and on width? I already faced this problem about 10 years ago. The variable font1 should be declared as static or to be a member of a class therefore as SetFont saves only the pointer it, but does not do a copy of the data.

6

Re: The type size in CStatic does not increase

Hello, SNNy, you wrote: SNN> https://social.msdn.microsoft.com/Forum … m=vcmfcatl Thanks, earned! But I have one more question - how to change text color in it m_IDC_STATIC1? I created class CMyStatic: public CStatic in which I redefined method OnPaint: CMyStatic:: OnPaint () {CPaintDC dc (this); CRect rc; GetClientRect (rc); CString str; dc. GetWindowText (str); dc. SetTextColor (RGB (255,0,0)); dc. DrawText (str,&rc,DT_CENTER);} the Font is displayed high (40) and wide (10) as I and set it, but it is displayed by black color, instead of red. How to make so that the text it was displayed by red color?

7

Re: The type size in CStatic does not increase

Hello, RussianFellow, you wrote: RF> the Font is displayed high (40) and wide (10) as I and set it, but it is displayed by black color, instead of red. RF> how to make so that the text it was displayed by red color? https://stackoverflow.com/questions/163 … xt-control

8

Re: The type size in CStatic does not increase

Hello, RussianFellow, you wrote: You already asked such questions Both about a font and about color, I even gave answers with a code sample

9

Re: The type size in CStatic does not increase

ES> You already asked such questions ES> Both about a font and about color, I even answers gave with a code sample However you to unwinding those answers cannot find, if could, you would result a hyperlink. Here and  cannot.

10

Re: The type size in CStatic does not increase

Hello, Evgeniy Skvortsov, you wrote: ES> Hello, RussianFellow, you wrote: ES> You already asked such questions ES> Both about a font and about color, I even answers gave Everything with a code sample, found, thanks! http://rsdn.org/forum/mfc/6670316.1 the author: Evgeniy Skvortsov Date: 18.01.17

11

Re: The type size in CStatic does not increase

Hello, Ejnstok Fajr, you wrote: > However you to unwinding cannot find those answers, if could, you would result a hyperlink. Here and  cannot. I also did not gather. Forum MFC dead, here something to find, two-three clique back.