Mega Code Archive

 
Categories / Delphi / VCL
 

Delete a Column in a TStringGrid

Title: Delete a Column in a TStringGrid? type TStringGridHack = class(TStringGrid) public procedure DeleteCol(ACol: Longint); end; var Form1: TForm1; implementation procedure TStringGridHack.DeleteCol(ACol: Longint); begin if ACol = FixedCols then if ACol = (ColCount - 1) then begin Cols[ACol].Clear; if ColCount(FixedCols + 1) then ColCount := (ColCount - 1); end else begin Cols[ACol] := Cols[ACol + 1]; DeleteCol(ACol + 1); end; end;