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

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

 
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 вся ветка

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



Память: 0.45 MB
Время: 0.006 c
2-1315307915
alexx777
2011-09-06 15:18
2011.12.18
сменить пользователя


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


3-1268739476
Rob
2010-03-16 14:37
2011.12.18
СУБД с возможностью хранения текстовых документов в сжатом виде.


15-1314369615
6136
2011-08-26 18:40
2011.12.18
html для отправки строки на сервер


15-1314256768
OW
2011-08-25 11:19
2011.12.18
C чего начать изучение Lotus Notes?




   Наверх