this slowpoke moves

Gradient StringGrid Cells

uses Grids, GraphUtil

//

procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
begin
  with StringGrid1.Canvas do
  begin
    Brush.Color := ColorHLSToRGB(ACol * 10, 60 + ARow * 5, 120);
    FillRect(Rect);
    Font.Color := ColorHLSToRGB(((ACol * 10) + 120) mod 240, 60 + ARow * 5, 120);
    TextOut(Rect.Left, Rect.Top, Format('(%d,%d)', [ACol, ARow]));
  end
end;

procedure TForm1.FormResize(Sender: TObject);
begin
  StringGrid1.DefaultRowHeight := ClientHeight div Succ(StringGrid1.RowCount);
  StringGrid1.DefaultColWidth := ClientWidth div Succ(StringGrid1.ColCount);
end;

initialization
  Randomize

Keine Kommentare:

Kommentar veröffentlichen

Beliebte Posts

Translate