Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums
Members
Pages
Search
Help
Register
Login
Home
Home
»
U++ Library support
»
Draw, Display, Images, Bitmaps, Icons
»
Centering text in a rectange
Show:
Today's Messages
::
Show Polls
::
Message Navigator
E-mail to friend
Re: Centering text in a rectange
[
message #35341
is a reply to
message #35340
]
Fri, 03 February 2012 17:21
jerson
Messages:
202
Registered:
June 2010
Location:
Bombay, India
Experienced Member
This is how I would do it. The gurus out here might have simpler ways to achieve the same
1- Get size of text to be displayed. You will use the GetTextSize() function to achieve this
2- Get the size of the rectangle using GetSize()
3- X position centered text will start at
PosX = (Rect_X_extent-Text_x_extent)/2
PosY = (Rect_Y_extent-Text_Y_extent)/2
4- put the text there.
You might need to consider rotation of text differently.
Maybe there are utility functions that achieve the same, but, I do not know as I'm a relative newbie
Report message to a moderator
[
Message index
]
Centering text in a rectange
By:
Alboni
on Fri, 03 February 2012 16:57
Re: Centering text in a rectange
By:
jerson
on Fri, 03 February 2012 17:21
Re: Centering text in a rectange
By:
mirek
on Sat, 04 February 2012 15:33
Re: Centering text in a rectange
By:
Alboni
on Fri, 03 February 2012 17:48
Previous Topic:
How to use the same .iml from multiple source files.
Next Topic:
Bug: Missing width in DrawArc on X11
Goto Forum:
- Community
U++ community news and announcements
PR, media coverage, articles and documentation
U++ Webs: Functioning, Layout , Design, Features and Structure of these forums, homepage etc.
Coffee corner
Newbie corner
U++ based job offers
- Developing U++
U++ Developers corner
External resources
Releasing U++
UppHub
Bugs (& fixes)
Documentation
U++ TheIDE and Library: Releases and ChangeLogs
Mac OS
Android
- U++ Library support
U++ Library : Other (not classified elsewhere)
U++ Core
Look and Chameleon Technology
U++ Libraries and TheIDE: i18n, Unicode and Internationalization
U++ SQL
U++ MT-multithreading and servers
U++ Callbacks and Timers
U++ Widgets - General questions or Mixed problems
TopWindow&PopUp, TrayIcon
Menus&Toolbars
StatusBar&InfoCtrl
Splitter
TabCtrl
Slider&ProgressIndicator
ArrayCtrl, HeaderCtrl & GridCtrl
TreeCtrl
RichText,QTF,RTF...
LineEdit, EditFields, DocEdit
Draw, Display, Images, Bitmaps, Icons
FileSel&FileList, Path
CalendarCtrl
Skylark
ScatterDraw & ScatterCtrl
Archive
- U++ TheIDE
U++ TheIDE: Other Features Wishlist and/or Bugs
U++ TheIDE: Compiling, Linking, Debugging of your packages
U++ TheIDE: Installation, Compiling and Running of theide
U++ TheIDE: CodeEditor, Assist++, Topic++
U++ TheIDE: Packages
U++ TheIDE: Layout (Forms) Designer
U++ TheIDE: Icon designer
- Extra libraries, Code snippets, applications etc.
U++ users applications in progress and useful code snippets, including reference examples!
U++ Esc Interpreter, Esc Macros and templates
U++ and AI
C++ language problems and code snippets
Applications created with U++
OS Problems etc., Win32, POSIX, MacOS, FreeBSD, X11 etc
-=]
Back to Top
[=-
[
Syndicate this forum (XML)
] [
] [
]
Current Time:
Wed May 14 11:32:17 CEST 2025
Total time taken to generate the page: 0.02611 seconds