Home » U++ Library support » TabCtrl » Background color of layout (How to change the background color of a layout )
Re: Background color of layout [message #48207 is a reply to message #48206] |
Mon, 05 June 2017 16:49   |
Oblivion
Messages: 1214 Registered: August 2007
|
Senior Contributor |
|
|
Hello,
You can override the Paint() function.
Layout.h:
class layouts : public WithlayoutsLayout<TopWindow> {
public:
typedef layouts CLASSNAME;
struct Tab1 : WithinputTab<ParentCtrl> {
Color cc;
virtual void Paint(Draw& w) override
{
auto r = GetRect();
w.DrawRect(r, cc);
}
void ChangeColor(Color c) { cc = c; Refresh(); }
};
Tab1 tab1;
WithoutputTab<ParentCtrl> tab2;
layouts();
void setTitle();
void setFrame();
};
Layout.cpp:
void layouts::setTitle()
{
tab1.but1.SetLabel("Pushed me");
tab1.ChangeColor(SMagenta());
}
Hope this helps.
Note that you can also add a background image this way (by painting it to the background). It's up to you.
Regards,
Oblivion.
Github page: https://github.com/ismail-yilmaz
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Mon, 05 June 2017 16:53] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sun Jul 06 21:34:38 CEST 2025
Total time taken to generate the page: 0.03650 seconds
|