forked from HemulGM/Components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HGM.Graphics.AnimateControl.pas
52 lines (41 loc) · 1010 Bytes
/
HGM.Graphics.AnimateControl.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
unit HGM.Graphics.AnimateControl;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, HGM.Common;
type
TAnimateControl = class(TThread)
protected
procedure Execute; override;
public
FHWnd: HWND;
FShow: Boolean;
constructor Create(Handle: HWND; Show: Boolean);
class procedure Show(Handle: HWND);
class procedure Hide(Handle: HWND);
end;
implementation
{ TAnimateControl }
constructor TAnimateControl.Create(Handle: HWND; Show: Boolean);
begin
FHWnd := Handle;
FShow := Show;
FreeOnTerminate := True;
inherited Create(False);
end;
procedure TAnimateControl.Execute;
begin
if FShow then
AnimateWindow(FHWnd, 250, AW_VER_POSITIVE or AW_SLIDE)
else
AnimateWindow(FHWnd, 250, AW_HIDE or AW_VER_NEGATIVE or AW_SLIDE);
end;
class procedure TAnimateControl.Hide(Handle: HWND);
begin
Create(Handle, False);
end;
class procedure TAnimateControl.Show(Handle: HWND);
begin
Create(Handle, True);
end;
end.