Вниз
Скачать: 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.012 c
1-3509
proc
2002-08-21 12:28
2002.09.02
Font в PageControl


6-3554
GM_
2002-06-18 09:20
2002.09.02
Помогите разобраться с WinPcap


3-3272
kinder
2002-08-12 14:07
2002.09.02
Выпадающий список в DBGrid


6-3559
S@shka
2002-06-21 19:02
2002.09.02
Клиент - сервер. Интересный вопрос


1-3507
Krutikov_Oleg
2002-08-21 10:03
2002.09.02
Проблема с курсорами.




   Наверх