Einzelnen Beitrag anzeigen

Hawkeye219

Registriert seit: 18. Feb 2006
Ort: Stolberg
2.227 Beiträge
 
Delphi 2010 Professional
 
#2

Re: Daten in Stringgrid makieren

  Alt 16. Jun 2006, 14:57
Hallo Crishnu,

hier ein wenig Code:

Delphi-Quellcode:
procedure MoveGridRow (aGrid: TStringGrid; aDirection: Integer);
  var i : integer;
begin
  with aGrid do
    // Plausibilitätstest
    if ((Abs(aDirection) = 1) and
        ((aDirection < 0) and (Row > FixedRows)) or
        ((aDirection > 0) and (Row < RowCount - 1))) then
      begin
        // Daten verschieben
        for i := FixedCols to ColCount - 1 do
          Cols[i].Exchange (Row, Row + aDirection);
        // Markierung verschieben
        Row := Row + aDirection;
        Selection := TGridRect(Rect(FixedCols, Row, ColCount - 1, Row));
      end;
end;

procedure TForm1.SpinButton1DownClick(Sender: TObject);
begin
  MoveGridRow (Grid, +1);
end;

procedure TForm1.SpinButton1UpClick(Sender: TObject);
begin
  MoveGridRow (Grid, -1);
end;
Gruß Hawkeye
  Mit Zitat antworten Zitat