本光盘是《Delphi 7应用教程》一书的配套光盘

源代码在线查看: unit1.pas

软件大小: 29767 K
上传用户: choatehou4
关键词: Delphi 光盘 应用教程
下载地址: 免注册下载 普通下载 VIP

相关代码

				unit Unit1;
				
				interface
				
				uses
				  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
				  Dialogs;
				
				type
				  TForm1 = class(TForm)
				    procedure FormCreate(Sender: TObject);
				    procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
				      Shift: TShiftState; X, Y: Integer);
				    procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
				      Shift: TShiftState; X, Y: Integer);
				    procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
				      Y: Integer);
				  private
				    { Private declarations }
				  public
				    { Public declarations }
				  end;
				
				var
				  Form1: TForm1;
				
				implementation
				  Var
				     PaintNow:Boolean;
				     X1,Y1:integer;
				
				{$R *.dfm}
				
				procedure TForm1.FormCreate(Sender: TObject);
				begin
				  Canvas.Pen.Width :=5;
				  Canvas.Pen.Color :=ClBlue;
				end;
				
				procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
				  Shift: TShiftState; X, Y: Integer);
				begin
				  PaintNow:=True;
				  x1:=x;
				  y1:=y;
				end;
				
				procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
				  Shift: TShiftState; X, Y: Integer);
				begin
				  PaintNow:=False;
				end;
				
				procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
				  Y: Integer);
				begin
				  If paintNow then
				     begin
				        Canvas.moveto(x1,y1);
				        Canvas.LineTo(x,y);
				     end;
				     x1:=x;y1:=y;
				end;
				
				end.
							

相关资源