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 print staticlabel text at an angle?
Re: How to print staticlabel text at an angle? [message #32391 is a reply to message #32385] Sun, 15 May 2011 14:59 Go to previous messageGo to previous message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
Hi, there!

Coincidentally, I needed it once too, and I wrote the following code, which worked fine for me:

in VerticalLabel.h file:
#include <CtrlLib/CtrlLib.h>

using namespace Upp;

struct VertDisplay : Display {
    virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const;
};

class VerticalLabel : public Label
{
	public:
	
		typedef VerticalLabel CLASSNAME;
		
		VerticalLabel();
		VerticalLabel& SetText(const char *text);
		
	private:
		PaintRect pr;
};



VerticalLabel.cpp file:
#include "VerticalLabel.h"

void VertDisplay::Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const
{
    w.DrawRect(r, paper);
	w.DrawText(r.left,r.top,900,q.ToString(),StdFont(),(style & CURSOR)&&(style & FOCUS)?SLtRed:ink);
}

VerticalLabel::VerticalLabel()
{
	SetAlign(ALIGN_LEFT);
	SetVAlign(ALIGN_BOTTOM);
	pr.SetDisplay(Single<VertDisplay>());
}

VerticalLabel& VerticalLabel::SetText(const char *text)
{
	pr.SetValue(text);
	SetPaintRect(pr);
	return *this;
}


I hope this helps.
 
Read Message
Read Message
Read Message
Previous Topic: Eigen and UPP? (STL question?)
Next Topic: [Printing] How to retrieve DPI, page size, etc
Goto Forum:
  


Current Time: Thu May 09 09:33:17 CEST 2024

Total time taken to generate the page: 0.02511 seconds