-
February 26th, 2013, 11:15 PM
#1
How set font style for button in MFC ?
I want to set font size and font color for button in MFC. But MFC differrent from win32. It have no font style in property. please help me , How set font color and font size for button in MFC ?
-
February 27th, 2013, 01:10 AM
#2
Re: How set font style for button in MFC ?
Originally Posted by mmc01
I want to set font size and font color for button in MFC. But MFC differrent from win32. It have no font style in property.
From this anybody could conclude that win32 does have ones, right? This is new to me, as VS uses the same resource editor for C++ projects, including MFC and Win32. You might be talking about WinForms, but this is absolutely different story.
please help me , How set font color and font size for button in MFC ?
You can change font family, size and weight quite easily by creating new font and setting it explicitly to the button. However, text color is changeable for owner-draw buttons only, but this button style makes you be responsible for drawing entire button face, borders, etc.
Best regards,
Igor
-
February 27th, 2013, 01:51 AM
#3
Re: How set font style for button in MFC ?
Explicitly define the Font style :
Code:
CFont SFont;
SFont.CreateFont(15,7,0,0,FW_BOLD,0,0,0,DEFAULT_CHARSET,0,0,0,0,"Times New Roman");
ButtonContolName.SetFont(&SFont);
Finally delete the CFont.
Refer the below link also :
Change color and font-color of a MFC-Button
Color Button
Regards,
SaraswathiSrinath
-
February 27th, 2013, 02:16 AM
#4
Re: How set font style for button in MFC ?
Originally Posted by saraswathisrinath
Explicitly define the Font style :
Code:
CFont SFont;
SFont.CreateFont(15,7,0,0,FW_BOLD,0,0,0,DEFAULT_CHARSET,0,0,0,0,"Times New Roman");
ButtonContolName.SetFont(&SFont);
Finally delete the CFont.
You do NOT need to explicitely delete a CFont object (more correct - underlying font handle). It will be deleted in CFont destructor
Victor Nijegorodov
-
February 27th, 2013, 03:22 AM
#5
Re: How set font style for button in MFC ?
Thank you Mr. Victor, Still now I used the below code in the next line SetFont() method.
SFont.DeleteObject();
Regards,
SaraswathiSrinath
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|