home *** CD-ROM | disk | FTP | other *** search
- unit Main;
-
- { Program copyright (c) 1995 by Charles Calvert }
- { Project Name: StrPCX }
-
- { This program shows how to use a TStringGrid
- component.
-
- I used this program when creating a screen shot
- for the book. I've kept it in this subdirectory
- so it will end up on the CD, which is someplace
- where I can find it in case I want to use it again. }
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs,
- Messages, Classes, Graphics,
- Controls, Forms, Dialogs,
- StdCtrls, Buttons, Grids;
-
- type
- TForm1 = class(TForm)
- StringGrid1: TStringGrid;
- procedure FormCreate(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- procedure TForm1.FormCreate(Sender: TObject);
- const
- S: string = 'This is a string on the heap';
- AddressStr: string = '0F02';
- var
- i: Integer;
- begin
- for i := 0 to 40 do
- StringGrid1.Cells[i, 0] := IntToStr(i);
- for i := 0 to 26 do
- StringGrid1.Cells[0, i] := Chr(i + 65);
- for i := 1 to Length(S) do
- StringGrid1.Cells[i + 2, 5] := S[i];
- for i := 1 to Length(AddressStr) do
- StringGrid1.Cells[i + 12, 15] := AddressStr[i];
- end;
-
- end.
-