CPB Mailing List

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TStringGrid: How to right-justify text?




1.1	How do I right-justify the text in a TStringGrid cell?
Put something like this in the OnDrawCell() event.
void __fastcall TForm1::
StringGrid1DrawCell(TObject *Sender, long Col, long Row,
                    TRect &Rect, TGridDrawState State)
{
  int tw = StringGrid1->Canvas->TextWidth
          (StringGrid1->Cells[Col][Row]);
  StringGrid1->Canvas->TextRect(Rect,
                                Rect.Right-tw-2,
                                Rect.Top+2,
                                StringGrid1->Cells[Col][Row]);
}



W Komornicki's Home Page | Main Index | Thread Index