如何背景透明
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.