» Help

How to centre text in a TEdit (alternative approach)

   

To centre text in an edit control named Edit1, do this:

with Edit1 do
  SetWindowlong(
    Handle, GWL_STYLE, GetWindowlong(Handle,GWL_STYLE)or ES_CENTER
  );

Also see Tip #85 for a different approach.

Author: JMS
Contributor: JMS
Added: 2010-04-08
Last updated: 2010-04-08

« Return to contents »