Reputation: 161
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
.
Upvotes: 0
Views: 1303
Reputation: 161
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
Upvotes: 1