Jump to content

Transparent Label in Progressbar


 Share

Recommended Posts

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>

$title = "MOZILLA"
$downloadurl = "https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/latest/win32/tr/Firefox%20Setup%2032.0.exe"
$downloadlocation = @DesktopDir&"\Setup.exe"

Download($downloadurl, $downloadlocation)

Func Download($address, $dest)
    Local $gui = GUICreate($title, 615, 209, 192, 124,$WS_CAPTION,$WS_EX_TOOLWINDOW)
    Local $gprogress = GUICtrlCreateProgress(56, 64, 513, 73)
    Local $close = GUICtrlCreateButton("Cancel", 96, 152, 433, 41, BitOR($BS_FLAT,$BS_ICON))
    GUICtrlSetTip(-1,"Closes download","Cancel",2)
    Local $glabel = GUICtrlCreateLabel("Download Starting...",136, 80, 372, 41)

    GUISetState(@SW_SHOW)
    WinSetOnTop($title,"", 1)

    Local $downloaded = 0
    Local $hDownload = InetGet($address,$dest,1,1)

    Do
        $msg = GUIGetMsg()
        Select
            Case $msg = 0
                Local $aData = InetGetInfo($hDownload)
                $nsize = Round($aData[0]/1048576,2)
                $ntotal = Round($aData[1]/1048576,2)
                $dspeed = AutoSizeFormat(($aData[0]-$downloaded)*2)
                $downloaded = $aData[0]
                GUICtrlSetData($gprogress,Round($nsize*100/$ntotal,2))
                If $aData[0] <> "" Then
                    GUICtrlSetData($glabel,"%"&Round($nsize*100/$ntotal, 0)&" Finished - "&$nsize&"/"&$ntotal&" MB ("&$dspeed&")")
                EndIf
                Sleep(500)
            Case $msg = $close
                InetClose($hDownload)
                GUIDelete($gui)
                FileDelete($dest)
                TraySetState(1)
                TrayTip($title, "Downloading canceled.", 5, 4)
                Sleep(5000)
                Exit
        EndSelect
    Until InetGetInfo($hDownload,2)

    GUICtrlSetData($gprogress, 100)
    InetClose($hDownload)
    Sleep(500)
    GUIDelete($gui)
EndFunc


Func AutoSizeFormat($size)
    If $size < 1024 Then
        $size = $size & " Byte/sn"
    ElseIf $size > 1024 AND $size < 1024 * 1024 Then
        $size = (Round($size / 1024, 2) & " KB/sn")
    ElseIf $size > 1024 * 1024 AND $size < 1024 * 1024 * 1024 Then
        $size = (Round($size / 1024 / 1024, 2) & " MB/sn")
    ElseIf $size > 1024 * 1024 * 1024 AND $size < 1024 * 1024 * 1024 * 1024 Then
        $size = (Round($size / 1024 / 1024 / 1024, 2) & " GB/sn")
    EndIf
    Return $size
EndFunc

How can i make transparent this Label.

Edited by bordomavi
Link to comment
Share on other sites

Try this.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Try

Local $glabel = GUICtrlCreateLabel("Download Starting...",136, 80, 372, 41)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

Cim Bom Bom forever  ;)

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...