type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure StringGrid1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
i,j : Integer;
begin
StringGrid1.RowCount := 100;
StringGrid1.ColCount := 100;
for i:=0 to StringGrid1.RowCount -1 do
for j:=0 to StringGrid1.ColCount -1 do
StringGrid1.Cells[i,j] := IntToStr(i*j);
end;
procedure TForm1.StringGrid1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key = VK_LEFT then
begin
Sendmessage(StringGrid1.Handle, WM_HSCROLL, SB_PAGELEFT, 0);
Key:=0;
end;
if Key= VK_RIGHT then
begin
Sendmessage(StringGrid1.Handle, WM_HSCROLL, SB_PAGERIGHT, 0);
Key:=0;
end;
end;