-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathskinform.pas
168 lines (136 loc) · 4.03 KB
/
skinform.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
{
Temporary feature: Skin for taskbar icons as background form
}
unit skinform;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, DWMApi, GDIPAPI, GDIPOBJ, xgraphics;
type
TSkinDimensions = record
Image: String;
LeftWidth: Integer;
TopHeight: Integer;
RightWidth: Integer;
BottomHeight: Integer;
OutsideBorderTop: Integer;
OutsideBorderBottom: Integer;
OutsideBorderLeft: Integer;
OutsideBorderRight: Integer;
end;
TSkin = class(TComponent)
private
Pic: TGdipBitmap;
Name: String;
Background: TSkinDimensions;
BackgroundLeft: TSkinDimensions;
BackgroundRight: TSkinDimensions;
BackgroundTop: TSkinDimensions;
end;
TForm2 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormPaint(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
_blurbehind: Boolean;
procedure WMShowWindow(var msg: TWMShowWindow);
procedure WMSize(var msg: TMessage); message WM_SIZE;
procedure RestoreRequest(var message: TMessage); message WM_USER + $1000;
public
{ Public declarations }
published
property BlurBehind: Boolean read _blurbehind write _blurbehind;
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
uses functions, main;
const
WndClassName = 'TSkinTaskbarDockWindow';
var
WndClass: TWndClass =
(
style : CS_HREDRAW or CS_VREDRAW;
cbClsExtra: 0;
cbWndExtra: 0;
hIcon: 0;
hCursor: 0;
hbrBackground: 0;
lpszMenuName: nil;
lpszClassName: WndClassName;
);
WindowList: TList;
WindowParent: HWND;
procedure TForm2.FormCreate(Sender: TObject);
var
renderPolicy: Integer;
begin
Color := clBlack;
EnableBlur(Self.Handle);
BorderIcons := [];
renderPolicy := 1;
if DwmCompositionEnabled then
DwmSetWindowAttribute(Self.Handle, DWMWA_EXCLUDED_FROM_PEEK or DWMWA_FLIP3D_POLICY, @renderPolicy, SizeOf(Integer));
SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) or WS_EX_TRANSPARENT or WS_EX_TOOLWINDOW {and not WS_EX_APPWINDOW});
// SetLayeredWindowAttributes(Handle,0,128, LWA_ALPHA);
// SetWindowPos(Handle,HWND_TOPMOST,Left,Top,Width, Height,SWP_NOMOVE or SWP_NOACTIVATE or SWP_NOSIZE);
// Winapi.Windows.SetParent(Self.Handle, Form1.Taskbar.handle);
end;
procedure TForm2.FormPaint(Sender: TObject);
begin
if TaskbarAccented then
begin
Canvas.Brush.Handle := CreateSolidBrushWithAlpha(BlendColors(GetAccentColor, clBlack,50), 200);
end
else
begin
if SystemUsesLightTheme then
Canvas.Brush.Handle := CreateSolidBrushWithAlpha($dddddd, 200) else
Canvas.Brush.Handle := CreateSolidBrushWithAlpha($222222, 200);
end;
Canvas.FillRect(Rect(0,0,Width,Height));
end;
procedure TForm2.FormResize(Sender: TObject);
begin
self.WindowState := wsNormal;
end;
procedure TForm2.FormShow(Sender: TObject);
begin
ShowWindow(Application.Handle, SW_HIDE);
end;
procedure TForm2.RestoreRequest(var message: TMessage);
begin
Self.Show;
end;
procedure TForm2.WMShowWindow(var msg: TWMShowWindow);
begin
if not msg.Show then
msg.Result := 0
else
inherited
end;
procedure TForm2.WMSize(var msg: TMessage);
begin
if msg.WParam = SIZE_MINIMIZED then
self.WindowState := wsNormal;
end;
{ TSkin }
(*function SkinWndProc(hWnd: HWND; uMsg: UINT; wParam: UINT; lParam: UINT):HRESULT; stdcall;
var
i: Integer;
begin
Result := DefWindowProc(hWnd, uMsg, wParam, lParam);
end;*)
(*initialization
WndClass.lpfnWndProc := @SkinWndProc;
WndClass.hInstance := HInstance;
Winapi.Windows.RegisterClass(WndClass);
WindowList := TList.Create;
WindowParent := CreateWindow(WndClassName, #0, WS_POPUP, 0, 0, 0, 0, 0, 0, HInstance, nil);
finalization
DestroyWindow(WindowParent);
WindowList.Free;*)
end.