Показать сообщение отдельно
  #2  
Старый 09.06.2010, 00:53
roamer roamer вне форума
Активный
 
Регистрация: 15.04.2009
Сообщения: 369
Репутация: 93
По умолчанию

Ячейку удалить нельзя (можно очистить).
Удалить можно или строку или колонку.
Примерно так :
Код:
//Удалить строку ARow
function StringGrid_DeleteRow(SG : TStringGrid; ARow : integer) : boolean;
Var
  N1,N2,i : integer;
begin
  Result:=FALSE;
  if SG<>NIL then begin
     N1:=ARow;
     N2:=(SG.RowCount-2);
     if (SG.RowCount-1)>SG.FixedRows then begin
        for i:=N1 to N2 do
         begin
           SG.Rows[i].Assign(SG.Rows[i+1]);
        end;
        SG.Rows[SG.RowCount-1].Clear;
        SG.RowCount:=SG.RowCount-1;
        Result:=TRUE;
     end
     else begin
        SG.Rows[SG.FixedRows].Clear;
        Result:=TRUE;
     end;
  end;
end;

//Удалить колонку ACol
function StringGrid_DeleteCol(SG : TStringGrid; ACol : integer) : boolean;
Var
  N1,N2,i : integer;
begin
  Result:=FALSE;
  if SG<>NIL then begin
     N1:=ACol;
     N2:=(SG.ColCount-2);
     if (SG.ColCount-1)>SG.FixedCols then begin
        for i:=N1 to N2 do
         begin
           SG.Cols[i].Assign(SG.Cols[i+1]);
        end;
        SG.Cols[SG.ColCount-1].Clear;
        SG.ColCount:=SG.ColCount-1;
        Result:=TRUE;
     end
     else begin
        SG.Cols[SG.FixedCols].Clear;
        Result:=TRUE;
     end;
  end;
end;
Ответить с цитированием