Recent

Author Topic: Text alignment in grid of TStringGrid  (Read 10739 times)

asdf

  • Sr. Member
  • ****
  • Posts: 310
Text alignment in grid of TStringGrid
« on: December 05, 2010, 05:23:51 pm »
Now in the default, it looks like 'Top'.
How could we set it to be like 'Bottom' ?
Lazarus 1.2.4 / Win 32 / THAILAND

ivan17

  • Full Member
  • ***
  • Posts: 173
Re: Text alignment in grid of TStringGrid
« Reply #1 on: December 06, 2010, 09:40:52 pm »
i'd say you need to draw cell contents yourself.

not the answer you wanted, i know, but it's what you need.

jesusr

  • Sr. Member
  • ****
  • Posts: 483
Re: Text alignment in grid of TStringGrid
« Reply #2 on: December 07, 2010, 06:18:25 pm »
take a look at this sample, it's using OnPrepareCanvas StringGrid Event: http://wiki.lazarus.freepascal.org/Grids_Reference_Page#Example:_How_to_align_column_text_in_StringGrids

The change it needs to align to bottom is instead of using Alignment textstyle property use Layout property, valid Layout values are tlTop tlBottom and tlCenter. tlCenter is default.

 

TinyPortal © 2005-2018