26-05-2020, 10:00 PM
PHP كود :
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
aRect: TRect;
myColumn: Integer;
begin
myColumn := 2;
if StringGrid1.Cells[myColumn, ARow] = StringGrid1.Cells[myColumn, ARow + 1]
then
begin
// Get cell TRect
aRect := StringGrid1.CellRect(myColumn, ARow);
// Colors should be different than normal cells
if gdSelected in State then
begin
StringGrid1.Canvas.Brush.Color := clTeal;
StringGrid1.Canvas.Font.Color := clWhite;
end
else
begin
StringGrid1.Canvas.Brush.Color := clMoneyGreen;
StringGrid1.Canvas.Font.Color := clBlack;
end;
StringGrid1.Canvas.FillRect(aRect);
StringGrid1.Canvas.TextOut(aRect.Left + 3, aRect.Top + 5,
StringGrid1.Cells[myColumn, ARow]);
end;
end;

