function TSkinStaticImage.CreateWindow(ParentHandle: HWND): HWND;
var
hBmp: HBitmap;
// ARgn: HRGN;
begin
if SkinEngine.RegisterButton(SKStaticImage)
then
begin
// Erstelle das GDIPLUS image vom Dateinamen
if (Width > 0)
and (Height > 0)
then
begin
hBmp := SkinEngine.FitBitmapFromFile(PWideChar(ImagePath), Width, Height);
Img := GDIP_CreateImageFromHBITMAP(0, hBmp);
end else
Img := SkinEngine.AddResource(ParentHandle, PWideChar(ImagePath));
if Img <> 0
then
begin
Style:= WS_CHILD
or WS_VISIBLE
or SS_BITMAP;
FHStaticImage := CreateWindowEx(WS_EX_TRANSPARENT, SKStaticImage,
nil,
Style, Left, Top, Width, Height, ParentHandle, DlgItemID, SkinEngine.skInstance,
nil);
if FHStaticImage <> 0
then
begin
SkinEngine.SetImageProperty(
Handle, PROP_IMAGE_BACK, LONG_PTR(Img));
SkinEngine.SetImageProperty(
Handle, PROP_STYLE, SS_BITMAP);
SkinEngine.SetImageProperty(
Handle, PROP_STATEMAX, 1);
// SkinEngine.SetProperty(Handle, PROP_REGION, 1);
if hBmp = 0
then
GdipCreateHBITMAPFromBitmap(img, hBmp, 0);
SendMessage(
Handle, STM_SETIMAGE, WPARAM(IMAGE_BITMAP), LPARAM(hBmp));
// ARgn := SkinEngine.RegionFromBitmap(hBmp, $FF00FF);
// SetWindowRgn(Handle, ARgn, true);
//
// DeleteObject(ARgn);
end;
end else
begin
// Lösche das Image
SkinEngine.DeleteResource(
Handle, Img);
end;
end;
result := FHStaticImage;
end;