Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Основная";
Текущий архив: 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
1-3493
CCCatch
2002-08-21 12:03
2002.09.02
КАК округлить число??


8-3526
Иван
2002-04-27 00:43
2002.09.02
Текст в Bitmap


3-3324
sndanil
2002-08-13 15:07
2002.09.02
Опять проблема с базой InterBase


14-3590
Ghost.
2002-08-06 16:23
2002.09.02
ZIP


1-3463
Flash1
2002-08-20 22:14
2002.09.02
Как узнать адрес в окне Internet Explorera?





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский