text with color/background #207
jordiperezartigues
started this conversation in
General
Replies: 1 comment 2 replies
-
|
Hola, @jordiperezartigues!
For example, the following class draws text using a fixed color specified in the constructor: class TColoredText : public TStaticText
{
public:
TColoredText(const TRect &bounds, TStringView text, TColorAttr color) :
TStaticText(bounds, text),
color(color)
{
}
virtual TColorAttr mapColor(uchar /*index*/) override
{
// Ignore palette index and always return the fixed attribute
return color;
}
private:
TColorAttr color;
};See the README for more information on how to define custom color attributes using |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
i am adding some text lines:
bbox->insert(new TStaticText(TRect(2,rTree,strwidth(treeName)+2,rTree+1), treeName));how can i add some format to the text, color and background? perhaps is needed using drawText() instead atach an TStaticText?
Beta Was this translation helpful? Give feedback.
All reactions