Вниз
Скачать: CL | DM;

Как удалить строки из 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 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.015 c
1-3333
new23
2002-08-21 16:00
2002.09.02
Создание таймера


1-3411
ктото
2002-08-22 17:35
2002.09.02
form1+memo1,form2+memo2 memo1.lines=memo2.lines


3-3322
angelcom
2002-08-08 19:48
2002.09.02
О это время!


3-3252
Ivanko
2002-08-09 19:40
2002.09.02
Кто смогёт или А и В сидели на трубе.


4-3684
?Feuerraeder
2002-07-02 04:42
2002.09.02
Как не дать окну свернуться




   Наверх