Grid
 Добавлено: 21.11.2019 21:07:25
Добавлено: 21.11.2019 21:07:25Как выделить редактируемую ячейку в StringGrid заданным цветом?
			форум
http://lazarus.freepascal.ru/forum/
http://lazarus.freepascal.ru/forum/viewtopic.php?f=33&t=42859
 Добавлено: 21.11.2019 21:07:25
Добавлено: 21.11.2019 21:07:25 Добавлено: 25.11.2019 12:30:49
Добавлено: 25.11.2019 12:30:49procedure TFrameGrid.sgItemsDrawCell(Sender: TObject; aCol, aRow: Integer;
  aRect: TRect; aState: TGridDrawState);
var
  TH, TW: Integer;
  CellText: String;
begin
  CellText := sgItems.Cells[ACol, ARow];
  // подсветка выделенных ячеек
  if gdSelected in AState then
  begin
    sgItems.Canvas.Font.Color := clHighLightText;
    sgItems.Canvas.Brush.Color := clHighLight;
    sgItems.Canvas.FillRect(ARect);
    TH := sgItems.Canvas.TextHeight(CellText);
    TW := sgItems.Canvas.TextWidth(CellText);
    sgItems.Canvas.TextOut((ARect.Left + ARect.Right) div 2 - TW div 2, (ARect.Top + ARect.Bottom) div 2 - TH div 2, CellText);
  end;  
end;