Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Начинающим";
Текущий архив: 2011.12.18;
Скачать: [xml.tar.bz2];

Вниз

матрица   Найти похожие ветки 

 
OW ©   (2011-09-08 12:48) [10]

unit Unit1;
interface
uses
 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
 Dialogs, Grids;
type
 TForm1 = class(TForm)
   StringGrid1: TStringGrid;
   procedure FormCreate(Sender: TObject);
 private    { Private declarations }
 public     { Public declarations }
 end;
type
TCSGrid = class(TStringGrid)
private
public
  procedure MoveRow(FromIndex, ToIndex: Longint);
  procedure MoveColumn(FromIndex, ToIndex: Longint);
end;
var
 Form1: TForm1;
implementation
{$R *.dfm}
procedure TCSGrid.MoveRow(FromIndex, ToIndex: Longint);
begin
RowMoved(FromIndex, ToIndex);
end;
procedure TCSGrid.MoveColumn(FromIndex, ToIndex: Longint);
begin
ColumnMoved(FromIndex, ToIndex);
end;
procedure DeleteRow(Sender: TStringGrid; FromIndex: Longint);
begin
if FromIndex > 0
then
  with TCSGrid(Sender) do
    if (RowCount > 2) and (FromIndex < RowCount) then
    begin
      if (FromIndex < RowCount - 1) then
        MoveRow(FromIndex, RowCount - 1);
      Rows[RowCount - 1].Clear;
      RowCount := RowCount - 1;
    end
end;
procedure DeleteColumn(Sender: TStringGrid; FromIndex: Longint);
begin
if FromIndex >= 0 then
  with TCSGrid(Sender) do
    if (ColCount > 0) and (FromIndex < ColCount) then
    begin
      if (FromIndex < ColCount - 1) then
        MoveColumn(FromIndex, ColCount - 1);
      Cols[ColCount - 1].Clear;
      ColCount := ColCount - 1;
    end
end;
procedure TForm1.FormCreate(Sender: TObject);
var
 i,j: Integer;
begin
 StringGrid1.RowCount := 9;
 StringGrid1.ColCount := 9;
 for i:= 0 to  StringGrid1.RowCount - 1 do
  for j := 0 to StringGrid1.ColCount - 1 do
    StringGrid1.Cells[i,j] := IntToStr(i+j*10);
// удалим 4-ю строку
 DeleteRow(StringGrid1, 4);
// удалим 7-ю столбец
 DeleteColumn(StringGrid1, 7);
end;

end.



Страницы: 1 вся ветка

Форум: "Начинающим";
Текущий архив: 2011.12.18;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.44 MB
Время: 0.004 c
15-1314369615
6136
2011-08-26 18:40
2011.12.18
html для отправки строки на сервер


15-1314908994
Юрий
2011-09-02 00:29
2011.12.18
С днем рождения ! 2 сентября 2011 пятница


2-1315378230
Виктор
2011-09-07 10:50
2011.12.18
Предупреждение


2-1315480506
LDV
2011-09-08 15:15
2011.12.18
правильное использование транзакций


2-1315307915
alexx777
2011-09-06 15:18
2011.12.18
сменить пользователя





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
Английский Французский Немецкий Итальянский Португальский Русский Испанский