Text vertical alignment in TwwDBGrid

astack

I noticed that text is not centralize vertically in TwwDBGrid and there is no property to do that. Is it any way to centralize text vertically in rows? I see there is a option to do that for TStringGrid, but no for TwwDBGrid.

astack

After research I figured out solution how to do text vertical alignment for TwwDBGrid. On DataDrawCellEvent I added code like below:

procedure TfrmTest.fraTestwwGridDrawDataCell(Sender: TObject;
  const Rect: TRect; Field: TField; State: TGridDrawState);
var
  MyRect: TRect;
begin
   fraTest.wwGrid.Canvas.FillRect(Rect); // clear area
   MyRect := Rect;

   DrawText(fraTest.wwGrid.Canvas.Handle, PChar(Field.AsString),
      Length(Field.AsString), MyRect, DT_VCENTER or DT_SINGLELINE or DT_NOPREFIX); // draw single line vertically centered

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related