constructor TSkinPanel.Create(hOwner: HWND; FullpathImageName:
string;
skLabel: PAnsiChar; x, y, xW, yH, ButID, StateMax: integer);
var
wc: TWndClassEx;
zClass: PAnsiChar;
begin
with SkinEngine
do
begin
zClass := SKPANEL;
wc.cbSize := SIZEOF(wc);
IsInitialized := GetClassInfoEx(skInstance, zClass, wc);
if IsInitialized = False
then
begin
wc.cbSize := SIZEOF(wc);
wc.style := CS_HREDRAW
or CS_VREDRAW
or CS_DBLCLKS
or CS_PARENTDC;
wc.lpfnWndProc := @PanelProc;
wc.cbClsExtra := 0;
wc.cbWndExtra := EXTEND_EXTRA * 4;
wc.hInstance := skInstance;
wc.hIcon := 0;
wc.hCursor := 0;
wc.hbrBackground := 0;
wc.lpszMenuName :=
nil;
wc.lpszClassName := zClass;
wc.hIconSm := wc.hIcon;
if RegisterClassEx(wc) <> 0
then
IsInitialized := True;
end;
if IsInitialized = True
then
begin
// Erstelle das GDIPLUS image von Datei
Img := AddResource(PAnsiChar(FullpathImageName));
if Img <> 0
then
begin
// Hole die Thumb GDIPLUS image größe
GetImageSize(Img, imgW, imgH);
Style := WS_CHILD
or WS_VISIBLE
or WS_TABSTOP;
FHPanel := CreateWindowEx(WS_EX_TRANSPARENT, SKPANEL, '
',
Style, x, y, xW, yH, hOwner, ButID, skInstance,
nil);
if FHPanel <> 0
then
begin
if StateMax < 1
then
StateMax := 1;
// Speichere das Image Handle in die Property
SetImageProperty(FHPanel, PROP_STYLE, BS_GROUPBOX);
SetImageProperty(FHPanel, PROP_IMAGE_BACK, Img);
SetImageProperty(FHPanel, PROP_STATEMAX, StateMax);
end else
// Image löschen wenn Fehler
DeleteResource(Img);
end;
end;
end;
end;