function
TSkin
.
SkinForm(hWnd:HWND):TGPBitmap;
var
img: TGPBitmap;
g:TGPGraphics;
si:PSImage;
Rect:TRect;
X, Y:
integer
;
Br:TGPBrush;
begin
GetWindowRect(hWnd, Rect);
img := TGPBitmap
.
Create(Rect
.
Right-Rect
.
Left, Rect
.
Bottom-Rect
.
Top, PixelFormat32bppARGB);
g:=TGPGraphics
.
Create(img);
if
SortedList[SKIN_FIRST]<>
nil
then
si:=SortedList[SKIN_FIRST].Next
else
si:=
nil
;
while
(si<>
nil
)
do
begin
if
(si
.
ID>SKIN_WND)
and
(si
.
ID<SKIN_WND_END)
then
begin
if
si
.
Pos
.
X>=
0
then
X:=si
.
Pos
.
X
else
X:=(Rect
.
Right-Rect
.
Left)+si
.
Pos
.
X;
if
si
.
Pos
.
Y>=
0
then
Y:=si
.
Pos
.
Y
else
Y:=(Rect
.
Bottom-Rect
.
Top)+si
.
Pos
.
Y;
case
si
.
ID
of
SKIN_WND_TOP, SKIN_WND_BOTTOM:
if
si
.
Image<>
nil
then
g
.
DrawImage(si
.
Image, X, Y, (Rect
.
Right-Rect
.
Left-
Abs
(si
.
Pos
.
X))+si
.
Size
.
X, si
.
Size
.
Y)
else
begin
Br:=TGPSolidBrush
.
Create(
Cardinal
(si
.
Color));
g
.
FillRectangle(Br, X, Y, (Rect
.
Right-Rect
.
Left-
Abs
(si
.
Pos
.
X))+si
.
Size
.
X, si
.
Size
.
Y);
Br
.
Free;
end
;
SKIN_WND_LEFT, SKIN_WND_RIGHT:
if
si
.
Image<>
nil
then
g
.
DrawImage(si
.
Image, X, Y, si
.
Size
.
X, (Rect
.
Bottom-Rect
.
Top-
Abs
(si
.
Pos
.
Y))+si
.
Size
.
Y)
else
begin
Br:=TGPSolidBrush
.
Create(
Cardinal
(si
.
Color));
g
.
FillRectangle(Br, X, Y, si
.
Size
.
X, (Rect
.
Bottom-Rect
.
Top-
Abs
(si
.
Pos
.
Y))+si
.
Size
.
Y);
Br
.
Free;
end
;
SKIN_WND_FILL:
if
si
.
Image<>
nil
then
g
.
DrawImage(si
.
Image, X, Y, (Rect
.
Right-Rect
.
Left-
Abs
(si
.
Pos
.
X))+si
.
Size
.
X, (Rect
.
Bottom-Rect
.
Top-
Abs
(si
.
Pos
.
Y))+si
.
Size
.
Y)
else
begin
Br:=TGPSolidBrush
.
Create(
Cardinal
(si
.
Color));
g
.
FillRectangle(Br, X, Y, (Rect
.
Right-Rect
.
Left-
Abs
(si
.
Pos
.
X))+si
.
Size
.
X, (Rect
.
Bottom-Rect
.
Top-
Abs
(si
.
Pos
.
Y))+si
.
Size
.
Y);
Br
.
Free;
end
else
if
si
.
Image<>
nil
then
g
.
DrawImage(si
.
Image, X, Y, si
.
Size
.
X, si
.
Size
.
Y)
else
begin
Br:=TGPSolidBrush
.
Create(
Cardinal
(si
.
Color));
g
.
FillRectangle(Br, X, Y, si
.
Size
.
X, si
.
Size
.
Y);
Br
.
Free;
end
;
end
;
end
;
si:=si
.
Next;
end
;
g
.
Free;
Result:=img;
end
;