📄 uformeffect.pas
字号:
unit uFormEffect;
interface
uses
windows,shellapi,IniFiles,SysUtils;
type
TFormEffect = class
public
procedure SetEffect(Enabled:boolean);
procedure FormOpen(const FormHandel: LongInt; const aSpeed: integer);
procedure FormClose(const FormHandel: LongInt; const aSpeed: integer);
end;
var
FormEffect:TFormEffect;
ini:TInifile;
FEnabled:boolean;
implementation
procedure TFormEffect.SetEffect(Enabled:boolean);
begin
FEnabled:=Enabled;
ini:=TIniFile.Create(ExtractFilePath(ParamStr(0)) +'Buttons.ini');
ini.WriteBool('Set','FormEffect',Enabled);
ini.Free;
end;
procedure TFormEffect.FormOpen(const FormHandel: LongInt; const aSpeed: integer);
var
hdc, Step1, Step2: LongInt;
Cx, Cy: LongInt;
ppp1: array[0..3] of Tpoint;
ppp2: array[0..3] of Tpoint;
rcCurrent: TRECT;
I, II: integer;
Radian: Double;
begin
if FEnabled then
begin
hdc := CreateDC('DISPLAY', nil, nil, nil);
SetROP2(hdc, R2_NOTXORPEN);
GetWindowRect(FormHandel, rcCurrent);
Cx := ((rcCurrent.Right - rcCurrent.Left) div 2) + rcCurrent.Left;
Cy := ((rcCurrent.Bottom - rcCurrent.Top) div 2) + rcCurrent.Top;
PPP1[0].x := Cx - 1;
PPP1[0].y := Cy - 1;
PPP1[1].x := PPP1[0].x + 1;
PPP1[1].y := PPP1[0].y - 1;
PPP1[2].x := PPP1[0].x + 1;
PPP1[2].y := PPP1[0].y + 1;
PPP1[3].x := PPP1[0].x - 1;
PPP1[3].y := PPP1[0].y + 1;
Step1 := (rcCurrent.Right - rcCurrent.Left) div aSpeed div 2;
Step2 := (rcCurrent.Bottom - rcCurrent.Top) div aSpeed div 2;
for I := 0 to aSpeed do
begin
PPP1[0].x := PPP1[0].x - Step1;
PPP1[0].y := PPP1[0].y - Step2;
PPP1[1].x := PPP1[1].x + Step1;
PPP1[1].y := PPP1[1].y - Step2;
PPP1[2].x := PPP1[2].x + Step1;
PPP1[2].y := PPP1[2].y + Step2;
PPP1[3].x := PPP1[3].x - Step1;
PPP1[3].y := PPP1[3].y + Step2;
Radian := I * Pi / aSpeed;
for II := 0 to 3 do
begin
PPP2[II].x := round((PPP1[II].x - Cx) * Cos(Radian) +
(PPP1[II].y - Cx) * Sin(Radian) + Cx);
PPP2[II].y := round((PPP1[II].y - Cy) *
Cos(Radian) - (PPP1[II].x - Cy) *
Sin(Radian) + Cy);
end;
Polygon(hdc, PPP2[0], 4);
Sleep(10);
Polygon(hdc, PPP2[0], 4);
end;
deletedc(hdc);
end;
end;
procedure TFormEffect.FormClose(const FormHandel: LongInt; const aSpeed: integer);
var
hdc, Step1, Step2: LongInt;
Cx, Cy: LongInt;
ppp1: array[0..3] of Tpoint;
ppp2: array[0..3] of Tpoint;
rcCurrent: TRECT;
I, II: integer;
Radian: Double;
begin
if FEnabled then
begin
hdc := CreateDC('DISPLAY', nil, nil, nil);
SetROP2(hdc, R2_NOTXORPEN);
GetWindowRect(FormHandel, rcCurrent);
Cx := ((rcCurrent.Right - rcCurrent.Left) div 2) + rcCurrent.Left;
Cy := ((rcCurrent.Bottom - rcCurrent.Top) div 2) + rcCurrent.Top;
PPP1[0].x := rcCurrent.Left;
PPP1[0].y := rcCurrent.Top;
PPP1[1].x := rcCurrent.Right;
PPP1[1].y := rcCurrent.Top;
PPP1[2].x := rcCurrent.Right;
PPP1[2].y := rcCurrent.Bottom;
PPP1[3].x := rcCurrent.Left;
PPP1[3].y := rcCurrent.Bottom;
Step1 := (rcCurrent.Right - rcCurrent.Left) div aSpeed div 2;
Step2 := (rcCurrent.Bottom - rcCurrent.Top) div aSpeed div 2;
for I := 0 to aSpeed do
begin
PPP1[0].x := PPP1[0].x + Step1;
PPP1[0].y := PPP1[0].y + Step2;
PPP1[1].x := PPP1[1].x - Step1;
PPP1[1].y := PPP1[1].y + Step2;
PPP1[2].x := PPP1[2].x - Step1;
PPP1[2].y := PPP1[2].y - Step2;
PPP1[3].x := PPP1[3].x + Step1;
PPP1[3].y := PPP1[3].y - Step2;
Radian := I * Pi / aSpeed;
for II := 0 to 3 do
begin
PPP2[II].x := round((PPP1[II].x - Cx) *
Cos(Radian) + (PPP1[II].y - Cx) * Sin(Radian) + Cx);
PPP2[II].y := round((PPP1[II].y - Cy) *
Cos(Radian) - (PPP1[II].x - Cy) * Sin(Radian) + Cy);
end;
Polygon(hdc, PPP2[0], 4);
Sleep(10);
Polygon(hdc, PPP2[0], 4);
end;
deletedc(hdc);
end;
end;
initialization
begin
ini:=TIniFile.Create(ExtractFilePath(ParamStr(0)) +'Buttons.ini');
FEnabled:=ini.ReadBool('Set','FormEffect',true);
ini.Free;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -