![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Как удалить строки из TStringGrid ? [D5, D6, Win95/98, WinXP]
Tokha © (2002-08-21 09:53:00)Уважаемый All!
Как в рантайме можно удалять строки из TStringGrid"а с замещением (со сдвигом оставшихся внизу строк вверх)? Пытался делать все от Rows[n].Clear до Rows[n].Free :) Ничего не помогает. При этом переписывать значения строк неоткуда, они только в стринггриде.
Спасибо заранее.
Ученик (2002-08-21 10:11:00) [1]type
TProtectedStringGrid = class(TStringGrid);
procedure TForm1.Button2Click(Sender: TObject);
begin
with TProtectedStringGrid(StringGrid1) do begin
RowMoved(Row, RowCount - 1);
if RowCount > 2 then
RowCount := RowCount - 1
else
Rows[1].Clear
end;
end;
I_A (2002-08-21 10:05:00) [2]x - индекс строки
with StringGrid do
if x < RowCount - 1 then
begin
while x + 1 <> RowCount do
begin
Rows[x].Clear;
Rows[x]:= Rows[x+1];
Inc(x);
end;
Rows[c].Clear;
end;
Lord Warlock (2002-08-21 09:59:00) [3]Например так:
GridRowCount:=MainGrid.RowCount-1;
GridColCount:=MainGrid.ColCount-1;
if MainGrid.Row=GridRowCount then
Exit;
for i:=MainGrid.Row to GridRowCount do
for j:=0 to GridColCount do
CellValue[j,i]:=CellValue[j,i+1];
for j:=1 to GridColCount do
MainGrid.Cells[j,GridRowCount]:="";
MBo (2002-08-21 09:56:00) [4]http://delphibase.endimus.com/?action=viewfunc&topic=vclctrl&id=10142