Reputation: 37
I'm making an application in C++ Builder 6. I need to use my own color in the Caption
of a TLabel
. I mean not a standard color like clBlue
, clRed
, etc, but like "8c8a8a"(it's grey), "dedcdc"(it's white). There are some hue of colors that I need.
I have searched the Internet but I have not found anything. Is there a way to do this?
Please don't say something like "Yes, change to VS/QT or something modern". I don't want to change away from C++Builder 6.
Upvotes: 1
Views: 6304
Reputation: 597385
Use a hex-encoded number, eg 0x8c8a8a
. This can be done in the Object Inspector at design-time, or in code at run-time:
Label1->Font->Color = (TColor) 0x8c8a8a;
Alternatively, use the Win32 RGB()
macro and type-cast the returned COLORREF
to TColor
. This can only be done in code at run-time:
Label1->Font->Color = (TColor) RGB (0x8c, 0x8a, 0x8a);
Upvotes: 2