Complete transparent form

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #36149
    surfer007
    Participant

    Hello,

    how can i set up a complete transparent form? For example, just use some Labels (TsLabelFX) and buttons (TsButton), and the form itself is completely transparent, only labels and buttons visible. Here is something that makes the form transparent, but it is not working using alphaskins 🙁

    Code:
    function SetFormTransparent(AFormHandle: HWnd; ATransparentColor: TColor): Boolean;
    const
    WS_EX_LAYERED = $00080000;
    LWA_COLORKEY = $00000001;
    var LStyle: Integer;
    LDLLHandle: Cardinal;
    LSetLayerdProc: function (Hwnd: THandle; crKey: COLORREF; bAlpha: Byte; dwFlags: DWORD): Boolean; stdcall;
    begin
    LDLLHandle := LoadLibrary('user32.dll');
    if LDLLHandle <> 0 then
    begin
    @LSetLayerdProc := GetProcAddress(LDLLHandle, 'SetLayeredWindowAttributes');
    if Assigned(LSetLayerdProc) then
    begin
    LStyle := GetWindowLong(AFormHandle, GWL_EXSTYLE);
    SetWindowLong(AFormHandle, GWL_EXSTYLE, LStyle or WS_EX_LAYERED);

    result := LSetLayerdProc(AFormHandle, ColorToRGB(ATransparentColor), 0, LWA_COLORKEY);
    end else result := False;
    FreeLibrary(LDLLHandle);
    end else result := False;
    end;

    procedure TForm1.FormCreate(Sender: TObject);
    begin
    color := clFuchsia;
    SetFormTransparent(handle, Color);
    end;

    Edit: Somehow TsLabelFX transparency is not working, see attached images…

    [attachment=6748:Image1.jpg] [attachment=6749:Image2.jpg]

    Thanks…

    #51976
    Support
    Keymaster

    Hello

    I'll try improve it in the nearest release, thank you for the demo.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.