Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
Oblivion is currently offline  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. Smile

Regards,

Oblivion.


[Updated on: Mon, 05 June 2017 16:53]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to plot image in one tab based on TabCtrl
Next Topic: trouble with tabs
Goto Forum:
  


Current Time: Sun Jul 06 21:34:38 CEST 2025

Total time taken to generate the page: 0.03650 seconds