Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#9

AW: AlphaBlend auf normale Controls

  Alt 12. Feb 2011, 11:47
@EWeiss

hey, lässt Du mal einen Fetzen Code rüberwachsen?
Etwas kompliziert..
Kann dir aber bei bedarf meinen Code zusenden bzw.. müßtest du von meinem Server runterladen.
Bild sieht nicht so gut aus das Forum hier konvertiert den Kram nach .JPG

Zitat:
@ EWeiss: Was kann ich denn in eigenen Panels einstellen, das ich nicht durch Ableitung einem bereits vorhandenen Panel ergänzen kann?
hast du doch schon selbst beantwortet..
Zitat:
Aber wie kann ich nen Panel auf die Form zeichnen, ohne nen Parent anzugeben??
Hier was Code..

Delphi-Quellcode:
    
EffectPanel := TSkinPanel.Create(hMain, SK_FOLDER +
  'Panel.png', '', 643, 48, 158, 366, ID_EFFECTPANEL, 0);
  SetAnchorMode(EffectPanel.Handle, ANCHOR_RIGHT);
  SetZorder(EffectPanel.Handle, HWND_TOP);
  PanelEffectHandle := EffectPanel.Handle;
Delphi-Quellcode:
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;
gruss

Geändert von EWeiss ( 9. Jul 2019 um 08:32 Uhr)
  Mit Zitat antworten Zitat