 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
LarryJ Guest
|
Posted: Mon Apr 17, 2006 10:03 pm Post subject: TEdit Centering Text |
|
|
Is it possible to center the Text in a TEdit? I don't see a property to
align the text.
Thanks
Larry |
|
| Back to top |
|
 |
JD Guest
|
Posted: Tue Apr 18, 2006 6:03 am Post subject: Re: TEdit Centering Text |
|
|
"LarryJ" <LarryJ33 (AT) austin (DOT) rr.com> wrote:
| Quote: |
Is it possible to center the Text in a TEdit?
|
Yes, but not reliably.
| Quote: | I don't see a property to align the text.
|
There isn't one. You need to apply ES_CENTER to it's GWL_STYLE.
For example:
::SetWindowLong( Edit1->Handle, GWL_STYLE, ::GetWindowLong(Edit1->Handle, GWL_STYLE) | ES_CENTER );
Keep in mind that if the underlying HWND is ever recreated,
you'll lose the ES_CENTER to you should override it's
CreateParams method instead. However, IIRC, Win98 and below do
not support center or right alignment on single line controls.
If you need to support all OS's, you need to use a multi-line control instead.
~ JD |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|