unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,IniFiles, ExtCtrls, Menus;
type
TForm1 = class(TForm)
Image1: TImage;
MainMenu1: TMainMenu;
sdasd1: TMenuItem;
Timer1: TTimer;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
procedure FormCreate(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure N2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
myinifile: Tinifile;
n:integer;
ni:integer;
m:integer;
mi:integer;
str:array[1..5]of string;
s:tstrings;
ss:string;
implementation
uses Unit2, Unit4, Unit3, Unit5;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
i:integer;
begin
if fileexists('./String.ini') then
begin
myinifile:=Tinifile.Create('./String.ini');
n:=myinifile.Readinteger('biaoye','lieshu',5);
m:=myinifile.Readinteger('biaoye','hangshu',8);
ni:=myinifile.Readinteger('biaoye','liekuan',100);
mi:=myinifile.Readinteger('biaoye','hangkuan',20);
image1.Height :=m*mi+10;
image1.Width :=n*ni+10;
s:=TStringlist.create;
myinifile.readsection('biaotou',s);
with image1do
begin
for i:=0 to mdo
begin
//Canvas.MoveTo(0,i*mi);
canvas.LineTo(ni*n,i*mi);
end ;
for i:=0 to ndo
begin
//Canvas.MoveTo(i*ni,0);
canvas.LineTo(i*ni,m*mi);
end ;
for i:=0 to n-1do
begin
ss:=myinifile.Readstring('biaotou',s.strings,'');
//canvas.Font.Size:=16;
//canvas.TextOut(i*ni+5,10,ss) ;
end ;
end;
end ;
end;
procedure TForm1.N1Click(Sender: TObject);
begin
form2.showmodal;
end;
procedure TForm1.N3Click(Sender: TObject);
begin
timer1.Enabled:=true;
end;
procedure TForm1.N4Click(Sender: TObject);
begin
form4.showmodal;
end;
procedure TForm1.N5Click(Sender: TObject);
begin
form1.Close ;
form3.Close ;
end;
procedure TForm1.N2Click(Sender: TObject);
begin
form5.showmodal;
end;
procedure TForm1.FormResize(Sender: TObject);
var
i:integer;
j:integer;
begin
myinifile:=Tinifile.Create('./String.ini');
//n:=myinifile.Readinteger('biaoye','lieshu',5);
//m:=myinifile.Readinteger('biaoye','hangshu',8);
//ni:=myinifile.Readinteger('biaoye','liekuan',100);
//mi:=myinifile.Readinteger('biaoye','hangkuan',20);
image1.Height :=form1.Height -20;
image1.Width:=form1.Width-20;
ni:=image1.Width div 5;
s:=TStringlist.create;
myinifile.readsection('biaotou',s);
Image1.Canvas.FillRect(Image1.Canvas.ClipRect);
with image1do
begin
for i:=0 to mdo
begin
Canvas.MoveTo(0,i*mi);
canvas.LineTo(ni*n,i*mi);
end ;
for i:=0 to ndo
begin
Canvas.MoveTo(i*ni,0);
canvas.LineTo(i*ni,m*mi);
end ;
for i:=0 to n-1do
begin
ss:=s.strings;
ss:=myinifile.Readstring('biaotou',ss,'');
canvas.Font.Size:=16;
canvas.TextOut(i*ni+5,10,ss) ;
end ;
end ;
myinifile.readsection('biao',s);
with image1do
begin
for j:=1 to m-1do
begin
for i:=0 to n-1do
begin
ss:=myinifile.Readstring('biao',s.strings[(j-1)*n+i],'');
canvas.Font.Size:=16;
canvas.TextOut(i*ni+5,j*mi+5,ss);
end;
end ;
end ;
end;
end.
各位dx们,这个表格不能自动适应窗体拉伸,不知道是拿哪里出了问题,帮我看看好吗?