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 » Community » Newbie corner » How to modify the back colour of a Static Text
Re: How to modify the back colour of a Static Text [message #27281 is a reply to message #27210] Sat, 10 July 2010 21:11 Go to previous messageGo to previous message
koldo is currently offline  koldo
Messages: 3361
Registered: August 2008
Senior Veteran
Hello Javier

Imagine you want to do an special Label control (an static text) with custom background and with some behavior when the mouse moves over it.

It could be more or less like this (I have not tested it Smile):

class MyCtrl : public Label {
typedef MyCtrl CLASSNAME;	 
public:
	virtual void Paint(Draw& draw) {
		Size sz = GetSize();
		w.DrawRect(0, 0, sz.cx, sz.cy);
	
		Label::Paint(w);
	}
	virtual void MouseMove(Point p, dword keyflags) {
		do here what you want
	}
	
public:
	Color background;

	MyCtrl& SetBackground(Color c) {background = c; Refresh(); return *this;}
	
	MyCtrl() {
		Transparent();
		NoWantFocus();

		background = Null;
	}
};




Best regards
IƱaki
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: guides and tutorials for a absolute beginner?
Next Topic: What is the difference between Splitter and SplitterFrame?
Goto Forum:
  


Current Time: Thu May 09 05:11:55 CEST 2024

Total time taken to generate the page: 0.02388 seconds