unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, AppEvnts, MMSystem, ExtCtrls;
type
TForm1 = class(TForm)
Eventos: TApplicationEvents;
MueveMosca: TTimer;
Mosca: TImage;
procedure FormCreate(Sender: TObject);
procedure EventosMessage(var Msg: tagMSG; var Handled: Boolean);
procedure MueveMoscaTimer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
// Cargamos el cursor
Screen.Cursors[1] := LoadCursorFromFile('C:\Documents and Settings\enecumene\My Documents\My Pictures\Mira.ani');
// Aqui lo usamos para el form
Cursor := 1;
end;
procedure TForm1.EventosMessage(var Msg: tagMSG; var Handled: Boolean);
var
x,y,w,z: integer;
begin
x := Mosca.Left;
y := Mosca.Top;
w := Mosca.Left+1;
if Msg.message = WM_RBUTTONUP then begin
sndPlaySound('C:\KillHim\Gun.wav',SND_NODEFAULT Or SND_ASYNC);
if (Mouse.CursorPos.X >= x) and (Mouse.CursorPos.Y <= w) then begin
MueveMosca.Enabled := False;
Mosca.Free;
end else begin
//Nada
end;
end;
end;
function Rotate(Canvas: TCanvas; Width, Height, iAngle: Integer; Back: LongBool): TBitmap;
var
Points: array [0..2] of TPoint;
Radio, Angle, _Angle: Real;
begin
Points[0] := Point(-Width, Height);
Points[1] := Point(Width, Height);
Points[2] := Point(-Width, -Height);
// Points[3] := Point(Width, -Height);
Radio := Sqrt(Sqr(Width / 2) + Sqr(Height / 2));
_Angle := (360 - (iAngle mod 360)) * pi / 180;
iAngle := 3;
repeat Dec(iAngle);
Angle := ArcTan(Points[iAngle].Y / Points[iAngle].X) + _Angle;
if Points[iAngle].X < 0 then
Angle := Angle + Pi;
Points[iAngle] := Point(Round((Cos(Angle) * Radio) + Radio), Round(Radio - (Sin(Angle) * Radio)));
until not LongBool(iAngle);
Result := TBitmap.Create;
Result.TransparentColor := clFuchsia;
Result.Canvas.Brush.Color := clFuchsia;
iAngle := Round(Radio * 2);
Result.Height := iAngle;
Result.Width := iAngle;
plgblt(Result.Canvas.Handle, Points, Canvas.Handle, 0, 0, Width, Height, 0, 0, 0);
if Back then Result.Canvas.CopyRect(Rect(0, 0, iAngle, iAngle), Result.Canvas, Rect(iAngle-1, 0, 0, iAngle));
end;
procedure TForm1.MueveMoscaTimer(Sender: TObject);
begin
Mosca.Left := Mosca.Left+1;
end;
end.