Link to home
Start Free TrialLog in
Avatar of LordDamein
LordDamein

asked on

Changes of label Font properties(BCB 4.0)

This one is really going to show that I have less than 2 years of C++ programming experiance....

Borland C++ Builder 4.0 pro  

Here is a code snippet from a switch statement that is supposed to change the font color and style (bold) depending on the value of an editbox variable.

case 1:
      {
         ...// some stuff
         if(water == 2)
         {
            water = 200;
            labelDiagWater->Font->Style = fsBold;
            labelDiagWater->Font->Color = clYellow;
         }
         ...// other stuff

This brings up:
[C++ Error]Main.cpp[167]: E2034 Cannot convert 'TFontStyle' to 'TFontStyles'.

If I comment out the fsBold line, the program runs fine and changes the font color to yellow when needed.  I cannot get the font to change to Bold.  I have tried all sorts of things, and the Borland help files, as great as they are, do not seem to be giving me the answer that I need.

Thanks...
Avatar of mirtol
mirtol

Yep, that's because Font->Style is a Set

To make bold use:
labelDiagWater->Font->Style << fsBold;

To make unbold use:
labelDiagWater->Font->Style >> fsBold;



ASKER CERTIFIED SOLUTION
Avatar of mirtol
mirtol

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LordDamein

ASKER

Well, I learned something new today!!!

Thanks...