If the text drawing routines use the top-left for position, then all you need to do is this.
Calculate where you want the centre of the text to be. For a button,
CentreX := Button.Left + (Button.Width / 2);
CentreY := Button.Top + (Button.Height / 2);
Calculate the width and height of the text. I don't know DelphiX, so I'm not sure what the functions would actually be.
TextWidth := GetTextWidth(MyString);
TextHeight := GetTextHeight(MyString);
Now calculate where to draw the text.
TextX := CentreX - (TextWidth / 2);
TextY := CentreY - (TextHeight / 2);
And draw it. Again, replace the function with what DelphiX actually uses.
DrawText(MyString, TextX, TextY);
Bookmarks