Click here to Skip to main content
15,887,371 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralA Doubt Pin
Rane31-Dec-03 16:05
Rane31-Dec-03 16:05 
GeneralRe: A Doubt Pin
Prakash Nadar31-Dec-03 18:35
Prakash Nadar31-Dec-03 18:35 
GeneralRe: A Doubt Pin
Michael Dunn31-Dec-03 19:48
sitebuilderMichael Dunn31-Dec-03 19:48 
Generalproblem with ListCtrl display Pin
Angel Kid31-Dec-03 15:14
Angel Kid31-Dec-03 15:14 
GeneralRe: problem with ListCtrl display Pin
Michael Dunn31-Dec-03 19:50
sitebuilderMichael Dunn31-Dec-03 19:50 
Generalgoing to post antialiasing article Pin
Roman Nurik31-Dec-03 12:56
Roman Nurik31-Dec-03 12:56 
Generalmenu bar Pin
brian scott31-Dec-03 12:21
brian scott31-Dec-03 12:21 
GeneralUsing SetFont() on a button control Pin
shultas31-Dec-03 11:32
shultas31-Dec-03 11:32 
Hello all.

I am trying to change the text/style of my button(s). Instead of the default, I want to make them Tahoma, 14pt. The code that I am using to do this is listed below. What is happening is this: If I put this code in the OnInitDialog() or OnPaint(), it somewhat works. The button will look different than the other ones, but now how I am specifying it to look. No matter what nHeight size that I use, it initializes to this same size every time, and bold. But, the funny thing is that the same exact code when used inside an OnBnClickedButton1() changes the font for that button text to exactly what I want. I am wondering why this same code is not working properly in the OnInitDialog() / OnPaint() ??

Also: I am wondering if there is a way to set the default font for the dialog buttons or set the font / size for the button text with the resource editor (instead of having to have code to "change" the font of the button) ?

Thanks


CFont ListBoxFont;
ListBoxFont.CreateFont(
14, // nHeight
0, // nWidth
0, // nEscapement
0, // nOrientation
FW_NORMAL, // nWeight
FALSE, // bItalic
FALSE, // bUnderline
0, // cStrikeOut
ANSI_CHARSET, // nCharSet
OUT_DEFAULT_PRECIS, // nOutPrecision
CLIP_DEFAULT_PRECIS, // nClipPrecision
DEFAULT_QUALITY, // nQuality
DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
"Tahoma"); // lpszFacename
m_button1.SetFont(&ListBoxFont,TRUE);
GeneralRe: Using SetFont() on a button control Pin
Roman Nurik31-Dec-03 12:58
Roman Nurik31-Dec-03 12:58 
GeneralRe: Using SetFont() on a button control Pin
Kelly Herald31-Dec-03 17:28
Kelly Herald31-Dec-03 17:28 
GeneralRe: Using SetFont() on a button control Pin
Rajesh match31-Dec-03 19:56
Rajesh match31-Dec-03 19:56 
GeneralRe: Using SetFont() on a button control Pin
shultas1-Jan-04 9:57
shultas1-Jan-04 9:57 
GeneralRe: Using SetFont() on a button control Pin
J.B.1-Jan-04 18:10
J.B.1-Jan-04 18:10 
GeneralIntercepting Mouse Clicks Pin
__Cerb31-Dec-03 10:06
__Cerb31-Dec-03 10:06 
GeneralRe: Intercepting Mouse Clicks Pin
alex.barylski31-Dec-03 10:17
alex.barylski31-Dec-03 10:17 
GeneralRe: Intercepting Mouse Clicks Pin
__Cerb31-Dec-03 10:26
__Cerb31-Dec-03 10:26 
QuestionUsing CList and collections properly? Pin
Cloaca31-Dec-03 9:01
Cloaca31-Dec-03 9:01 
AnswerRe: Using CList and collections properly? Pin
Cloaca5-Jan-04 4:21
Cloaca5-Jan-04 4:21 
GeneralNMAKE, Implicit Rules and unknown file types Pin
Bryan Anslow31-Dec-03 8:06
Bryan Anslow31-Dec-03 8:06 
GeneralDAO in SDK app (supports MFC) Pin
Jay231-Dec-03 6:19
Jay231-Dec-03 6:19 
GeneralRe: DAO in SDK app (supports MFC) Pin
Selvam R1-Jan-04 19:21
professionalSelvam R1-Jan-04 19:21 
GeneralCompare sign of numbers in C++ Pin
Gagnon Claude31-Dec-03 6:19
Gagnon Claude31-Dec-03 6:19 
GeneralRe: Compare sign of numbers in C++ Pin
Dominik Reichl31-Dec-03 6:59
Dominik Reichl31-Dec-03 6:59 
GeneralRe: Compare sign of numbers in C++ Pin
Stefan Pedersen1-Jan-04 7:00
Stefan Pedersen1-Jan-04 7:00 
GeneralRe: Compare sign of numbers in C++ Pin
Tim Smith31-Dec-03 10:41
Tim Smith31-Dec-03 10:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.