Форум: "Основная";
Текущий архив: 2002.09.02;
Скачать: [xml.tar.bz2];
ВнизКак удалить строки из TStringGrid ? Найти похожие ветки
← →
Tokha (2002-08-21 09:53) [0]Уважаемый All!
Как в рантайме можно удалять строки из TStringGrid"а с замещением (со сдвигом оставшихся внизу строк вверх)? Пытался делать все от Rows[n].Clear до Rows[n].Free :) Ничего не помогает. При этом переписывать значения строк неоткуда, они только в стринггриде.
Спасибо заранее.
← →
MBo (2002-08-21 09:56) [1]http://delphibase.endimus.com/?action=viewfunc&topic=vclctrl&id=10142
← →
Lord Warlock (2002-08-21 09:59) [2]Например так:
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]:="";
← →
I_A (2002-08-21 10:05) [3]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;
← →
Ученик (2002-08-21 10:11) [4]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;
Страницы: 1 вся ветка
Форум: "Основная";
Текущий архив: 2002.09.02;
Скачать: [xml.tar.bz2];
Память: 0.44 MB
Время: 0.007 c