Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Changes of label Font properties(BCB 4.0)

Posted on 2002-05-16
3
Medium Priority
?
696 Views
Last Modified: 2013-12-03
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...
0
Comment
Question by:LordDamein
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Expert Comment

by:mirtol
ID: 7013673
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;



0
 
LVL 2

Accepted Solution

by:
mirtol earned 200 total points
ID: 7013680
Oh and to just set the style to bold (no underline, italic etc) use:

labelDiagWater->Font->Style = TFontStyles() << fsBold;
0
 

Author Comment

by:LordDamein
ID: 7014108
Well, I learned something new today!!!

Thanks...
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question