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 » Draw, Display, Images, Bitmaps, Icons » Centering text in a rectange
Centering text in a rectange [message #35340] Fri, 03 February 2012 16:57 Go to previous message
Alboni is currently offline  Alboni
Messages: 214
Registered: January 2012
Location: Deventer, Netherlands
Experienced Member
I need to display a number or objectname on top of a bitmap. I can't figure out how to get the text centered over the bitmap.

index.php?t=getfile&id=3640&private=0

// Relevant portion of the code I wrote
void Furniture::Paint(Draw& d)
{
switch (orientation)
{
case 1 : d.DrawImage(x,y,w,h,RotateClockwise(Img::Get(image))); break;
case 2 : d.DrawImage(x,y,w,h,Rotate180(Img::Get(image))); break;
case 3 : d.DrawImage(x,y,w,h,RotateAntiClockwise(Img::Get(image))); break;
default: d.DrawImage(x,y,w,h,Img::Get(image));
}
d.DrawText(x+w/3,y+h/3,name,Arial(30), Magenta);
}
  • Attachment: table.png
    (Size: 10.59KB, Downloaded 565 times)

[Updated on: Fri, 03 February 2012 17:01]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to use the same .iml from multiple source files.
Next Topic: Bug: Missing width in DrawArc on X11
Goto Forum:
  


Current Time: Thu Mar 28 19:37:31 CET 2024

Total time taken to generate the page: 0.01140 seconds