unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, DB, Mask, DBCtrls, ADODB, DBTables, Grids,
DBGrids;
type
TForm1 = class(TForm)
Button1: TButton;
Image1: TImage;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit4: TEdit;
Label4: TLabel;
Label5: TLabel;
ADOConnection1: TADOConnection;
Label6: TLabel;
Button2: TButton;
Edit5: TEdit;
DataSource1: TDataSource;
ADOQuery1: TADOQuery;
Label7: TLabel;
DBGrid1: TDBGrid;
Edit6: TEdit;
Button3: TButton;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
Label8: TLabel;
Memo1: TMemo;
DBNavigator1: TDBNavigator;
Button4: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure tform1.gj1(x,y:integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var x,y,z,a,b,c,d,m:integer;
begin
try
image1.canvas.fillrect(Rect(0,0,1000,1000)); //.Pen.color:=clmenu;
image1.Canvas.pen.Width :=2;
image1.canvas.Refresh;
x:=strtoint(edit2.text)div 5+80;
y:=strtoint(edit1.Text)div 5+80;
z:=strtoint(edit3.text)div 5;
c:=z+x;
d:=z+y;
a:=80-z;
b:=80-z;
m:=strtoint(edit4.Text )div 5;
image1.canvas.pen.Color :=clblack;
image1.Canvas .rectangle(a,b,c,d);
image1.canvas.rectangle(80,80,x,y);
gj1(80,m);
except
application.MessageBox('请输入有效的数值','系统提示');
end;
end;
procedure gj1(x,y:integer);
begin
form1.Image1.Canvas .pen.Width :=6;
form1.Image1.Canvas.MoveTo(x+y,x+y);
form1.Image1.Canvas.LineTo(x+y+1,x+y);
end;