标签:style blog http color os io for 2014
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages,
System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
Vcl.ExtCtrls;
type
TForm1 = class(TForm)
Image1:
TImage;
procedure
Image1MouseMove(Sender: TObject; Shift: TShiftState;
X,
Y:
Integer);
procedure
Image1MouseDown(Sender: TObject; Button:
TMouseButton;
Shift: TShiftState; X, Y:
Integer);
procedure
Image1MouseUp(Sender: TObject; Button:
TMouseButton;
Shift: TShiftState; X, Y:
Integer);
procedure
FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1:
TForm1;
pt:tpoint;
Move:integer ;
implementation
{$R
*.dfm}
procedure
TForm1.FormCreate(Sender: TObject);
begin
with Image1.Canvas do
begin
Pen.Width:=10;
Pen.Color:=clRed;
brush.Style:=bsCross;
//透明
end;
end;
procedure TForm1.Image1MouseDown(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState; X, Y:
Integer);
begin
move:=1;
pt.x:=x;
pt.Y:=y;
end;
procedure TForm1.Image1MouseMove(Sender: TObject;
Shift: TShiftState; X,
Y: Integer);
begin
if move<>0 then
begin
Image1.Canvas.MoveTo(pt.X,pt.Y);
Image1.Canvas.LineTo(x,y);
pt.X:=x;
pt.Y:=y;
end;
end;
procedure TForm1.Image1MouseUp(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState; X, Y:
Integer);
begin
Move:=0;
end;
end.
Image1.Canvas画图笔刷,布布扣,bubuko.com
标签:style blog http color os io for 2014
原文地址:http://www.cnblogs.com/xe2011/p/3876047.html