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  |
 |
Alboni
Messages: 216 Registered: January 2012 Location: Kajaani, Finland
|
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.

// 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 647 times)
[Updated on: Fri, 03 February 2012 17:01] Report message to a moderator
|
|
|
|
|
|
Goto Forum:
Current Time: Fri Apr 25 12:22:51 CEST 2025
Total time taken to generate the page: 0.00934 seconds
|