dbgrid: fixed cell grid might draw over vertical grid lines (issue #8318)

grid: added small margin at the right side of cell so text near the grid line looks better

git-svn-id: trunk@10628 -
This commit is contained in:
jesus 2007-02-12 19:27:56 +00:00
parent 332746fa0f
commit d947dfbb55
2 changed files with 6 additions and 2 deletions

View File

@ -2398,7 +2398,9 @@ end;
procedure TCustomDBGrid.DrawCell(aCol, aRow: Integer; aRect: TRect; procedure TCustomDBGrid.DrawCell(aCol, aRow: Integer; aRect: TRect;
aState: TGridDrawState); aState: TGridDrawState);
begin begin
inherited DrawCell(aCol, aRow, aRect, aState); PrepareCanvas(aCol, aRow, aState);
if DefaultDrawing then
Canvas.FillRect(aRect);
{$ifdef dbgGridPaint} {$ifdef dbgGridPaint}
DbgOut(' ',IntToStr(aCol)); DbgOut(' ',IntToStr(aCol));
if gdSelected in aState then DbgOut('S'); if gdSelected in aState then DbgOut('S');
@ -2409,6 +2411,7 @@ begin
OnDrawColumnCell(Self, aRect, aCol, TColumn(ColumnFromGridColumn(aCol)), aState) OnDrawColumnCell(Self, aRect, aCol, TColumn(ColumnFromGridColumn(aCol)), aState)
else else
DefaultDrawCell(aCol, aRow, aRect, aState); DefaultDrawCell(aCol, aRow, aRect, aState);
DrawCellGrid(aCol, aRow, aRect, aState);
end; end;
procedure TCustomDBGrid.DrawCheckboxBitmaps(aCol: Integer; aRect: TRect; procedure TCustomDBGrid.DrawCheckboxBitmaps(aCol: Integer; aRect: TRect;

View File

@ -2983,9 +2983,10 @@ end;
procedure TCustomGrid.DrawCellText(aCol, aRow: Integer; aRect: TRect; procedure TCustomGrid.DrawCellText(aCol, aRow: Integer; aRect: TRect;
aState: TGridDrawState; aText: String); aState: TGridDrawState; aText: String);
begin begin
dec(aRect.Right, 3);
case Canvas.TextStyle.Alignment of case Canvas.TextStyle.Alignment of
Classes.taLeftJustify: Inc(aRect.Left, 3); Classes.taLeftJustify: Inc(aRect.Left, 3);
Classes.taRightJustify: Dec(aRect.Right, 3); Classes.taRightJustify: Dec(aRect.Right, 1);
end; end;
case Canvas.TextStyle.Layout of case Canvas.TextStyle.Layout of
tlTop: Inc(aRect.Top, 3); tlTop: Inc(aRect.Top, 3);