AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

NativeInt to string

Ein Thema von venice2 · begonnen am 10. Sep 2022 · letzter Beitrag vom 10. Sep 2022
 
venice2
(Gast)

n/a Beiträge
 
#4

AW: NativeInt to string

  Alt 10. Sep 2022, 15:24
Es stimmt was nicht mehr.

ImgBack: LONG_PTR;

Das ImgBack wird geladen .

ImgBack := SkinEngine.skCreateImageFromFile(SelectedImg);
Delphi-Quellcode:
function TSkinEngine.skCreateImageFromFile(FileName: WideString): LONG_PTR;
var
  Img: LONG_PTR;
begin

  Img := 0;

  if not FileExists(FileName) then
  begin
    Result := 0;
    Exit;
  end;

  //Image laden
  try
    GdipCheck(GdipLoadImageFromFile(PWideChar(FileName), Img));
  finally
    Result := Img;
  end;
end;
und in eine TStringList gepackt.
SetProperty(Handle, PROP_IMAGE_SELECTED, ImgBack);
Delphi-Quellcode:
procedure TSkinListBox.SetProperty(WinHandle: hWnd; Item: Integer; V: LONG_PTR);
begin
  if (Item > 0) and (WinHandle <> 0) then
    PropList.Add(IntToStr(WinHandle) + ',' + IntToStr(Item) + ',' + IntToStr(V));

end;
Delphi-Quellcode:
function TSkinListBox.GetProperty(WinHandle: hWnd; Item: Integer): LONG_PTR;
var
  SplitProperty: TSplitStrArray;
  IntI: Integer;
begin
  Result := 0;

  if (Item > 0) and (WinHandle <> 0) then
  begin
    for IntI := 0 to PropList.Count - 1 do
    begin
      SplitProperty := Split(PropList.Strings[IntI], ',');
      if SplitProperty[0] = IntToStr(WinHandle) then
      begin
        Result := LONG_PTR(SplitProperty[2]);
        exit;
      end;
    end;
  end;

end;
Später lese ich das ImgBack aus den Propertys zurück.

ImgBack := GetProperty(WinHandle, PROP_IMAGE_SELECTED);

Zeichne ich jetzt den Button
Delphi-Quellcode:
          SkinEngine.PaintButton(Graphics, 4, ImgBack, Rect.Left,
            Rect.Top - (ListItemHeight - 16) div 2, UInt(Rect.Right - FLeft), UInt(ListItemHeight),
            BS_PUSHBUTTON)
und hole mir die Image Größe dann krachts.
Delphi-Quellcode:
  if ImgBack <> 0 then
  begin
    GetImageSize(ImgBack, BackW, BackH);
Delphi-Quellcode:
procedure TSkinEngine.GetImageSize(Img: LONG_PTR; var imgW, imgH: UINT);
begin
  if img <> 0 then
  begin
    GdipCheck(GdipGetImageWidth(Img, imgW));
    GdipCheck(GdipGetImageHeight(Img, imgH));
  end;
end;
Die Probleme habe ich nur unter 64Bit und D11.2 vorher unter D11 funktioniert noch alles.

Geändert von venice2 (10. Sep 2022 um 16:16 Uhr)
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:55 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz