PDA

Click to See Complete Forum and Search --> : BOLD Font - Simple Question Really.


Stockton.S
Jan 10th, 2001, 05:02 AM
How do you make a lable have bold font at run time

label1->font->style->fsBold

is what I expected but it appears that it doesn't work

parksie
Jan 10th, 2001, 05:06 AM
What are you using? Borland? Microsoft? MFC? API?

Stockton.S
Jan 10th, 2001, 05:07 AM
Borland C++ Builder 4
Thanks

Simon

parksie
Jan 10th, 2001, 05:10 AM
I don't have BC++B...so all I can offer is: check your indirection levels. Are they all pointers?

What the error is might help.

Vlatko
Jan 10th, 2001, 06:53 AM
Try this

HFONT f = CreateFont(13,0,0,0,FW_BOLD,0,0,0,DEFAULT_CHARSET,OUT_CHARACTER_PRECIS,CLIP_CHARACTER_PRECIS,DEFAULT _QUALITY,DEFAULT_PITCH | FF_DONTCARE,"Arial");
SendMessage(GetDlgItem(hDlg,IDC_STATIC1),WM_SETFONT,(WPARAM)f,MAKELPARAM(TRUE, 0));

Stockton.S
Jan 10th, 2001, 06:59 AM
I already have the structure

ScoreLabel40->Font->Color = clBlack;
ScoreLabel40->Font->Size = 10;

and what I want to do it make the font bold, I think it is something like

ScoreLabel40->Font->Style << fsBold;

But that doesn't work.

Thanks for your help

Simon

Vlatko
Jan 10th, 2001, 10:47 AM
I've never used Borland C++, but the code i gave you uses only API so it will work for tou. Create the font then send a messsge to ScoreLabel40 to set the font.

parksie
Jan 10th, 2001, 12:00 PM
I'm just guessing, but perhaps:

ScoreLabel40->Font->Style |= fsBold;

Vlatko
Jan 10th, 2001, 03:33 PM
I'm guessing too but anyway try this:

ScoreLabel40->Font->Style = ScoreLabel40->Font->Style<< fsBold;