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 » U++ Widgets - General questions or Mixed problems » AlignDisplay bug (?)
AlignDisplay bug (?) [message #6660] Wed, 22 November 2006 01:33 Go to previous message
zsolt is currently offline  zsolt
Messages: 702
Registered: December 2005
Location: Budapest, Hungary
Contributor
The base Display class draws text vertically centered. This would be nice for AlignDisplay also, but renders text to its top.
I changed AlignDisplay to render text vertically centered:
In TDraw/Util.cpp, the last two lines are my changes:
void AlignDisplay::Paint(Draw& draw, const Rect& rc, const Value& v, Color ink, Color paper, dword style) const
{
	String s = StdFormat(v);
	Font font = StdFont();
	Size size = GetTextSize(s, font);
	draw.DrawRect(rc, paper);
	int x = rc.left;
	switch(align)
	{
	case ALIGN_CENTER: x += (rc.Width() - size.cx) >> 1; break;
	case ALIGN_RIGHT:  x = rc.right - size.cx; break;
	}
	int y = rc.top + max((rc.Height() - size.cy) / 2, 0);
	draw.DrawText(x, y, s, font, ink);
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: DropList bug
Next Topic: Mouse wheel and TopWindow
Goto Forum:
  


Current Time: Wed Jun 04 21:44:01 CEST 2025

Total time taken to generate the page: 2.27693 seconds