Sign in to follow this  
Followers 0
Kivin

Window Transparency Changer

2 posts in this topic

Change current window to next window with use of Transparency

;===============================================================================
;Входящие в состав программы файлы
;===============================================================================
#include <file.au3>
#include <GUIConstants.au3>
#Include <Array.au3>
#include <IE.au3>
;===============================================================================
;Основные параметры
;===============================================================================
$StepTransparency = 5
$MaximumTransparency = 240
$SleepTimeTransparency = 1
$Exit = 1; Не изменяйте эту переменную
;===============================================================================
;Главное окно
;===============================================================================
$MainWindow             = GUICreate ( "Transparency Test", 300, 50 )
$MainWindowIcon         = GUISetIcon ( "shell32.dll", 185 )
$ExportDataButton       = GUICtrlCreateButton ( "Test", 100,10,100,25)
StartProgram ($MainWindow)
;===============================================================================
;Основные функции
;===============================================================================
Func HideShowWindow ($CurrentWindow, $NextWindow)
    Dim $CurrentWindowTransparency = $MaximumTransparency
    For $CurrentWindowTransparency = $MaximumTransparency To 0 Step -$StepTransparency
        WinSetTrans( $CurrentWindow, "", $CurrentWindowTransparency )
        Sleep ( $SleepTimeTransparency )
    Next
    WinSetTrans ( $NextWindow, "", 0 )
    GUISetState ( @SW_SHOW, $NextWindow )
    GUISetState ( @SW_HIDE, $CurrentWindow )
    Dim $NextWindowTransparency = 0
    For $NextWindowTransparency = 0 To $MaximumTransparency Step $StepTransparency
        WinSetTrans( $NextWindow, "", $NextWindowTransparency)
        Sleep( $SleepTimeTransparency )
    Next
    WinSetTrans ( $NextWindow, "", $MaximumTransparency )
EndFunc

Func ExitProgram ($CurrentWindow)
    Dim $CurrentWindowTransparency = $MaximumTransparency
    For $CurrentWindowTransparency = $MaximumTransparency To 0 Step -$StepTransparency
        WinSetTrans( $CurrentWindow, "", $CurrentWindowTransparency )
        Sleep ( $SleepTimeTransparency )
    Next
    Sleep ( 100 )
    Exit
EndFunc 

Func StartProgram ($CurrentWindow)
    Dim $CurrentWindowTransparency = 0
    WinSetTrans( $CurrentWindow, "", $CurrentWindowTransparency )
    GUISetState ( @SW_SHOW, $CurrentWindow )
    For $CurrentWindowTransparency = 0  To $MaximumTransparency Step $StepTransparency
        WinSetTrans( $CurrentWindow, "", $CurrentWindowTransparency )
        Sleep ( $SleepTimeTransparency )
    Next
    Dim $CurrentWindowTransparency = $MaximumTransparency
    WinSetTrans( $CurrentWindow, "", $MaximumTransparency )
EndFunc 

Func DiscInformation ()
        $RoundPercent = 2
        $RoundMb = 2
        $DiscPath = "C:/"
        $DiscFreeSpace          = DriveSpaceFree ( $DiscPath )
        $DiscTotalSpace             = DriveSpaceTotal ( $DiscPath )
        Dim $DiscFreeSpace
        Dim $DiscTotalSpace
        $DiscFreeSpacePercent       = Round ($DiscFreeSpace/$DiscTotalSpace*100, $RoundPercent)
        $DiscUseSpacePercent        = Round (100 - $DiscFreeSpace/$DiscTotalSpace*100, $RoundPercent)
        Dim $DiscUseSpacePercent
        $DiscFreeSpaceMb            = Round ($DiscFreeSpace, $RoundMb)
        $DiscTotalSpaceMb           = Round ($DiscTotalSpace, $RoundMb)
        $DiscInformationWindow  = GUICreate ( "Information", 400, 100,-1,-1,$WS_CAPTION)        
        $DiscUseSpaceProgressbar    = GUICtrlCreateProgress ( 10, 10, 380, 15 )
        $DiscUseSpaceProgressbarData = GUICtrlSetData ($DiscUseSpaceProgressbar,$DiscUseSpacePercent)
        $DiscInformation = GUICtrlCreateLabel ( "Free  " & $DiscFreeSpaceMb & " Mb from " & $DiscTotalSpaceMb & " Mb",10,50,400,-1)
        $DiscInformationWindowOkButton = GUICtrlCreateButton ( "Ok",150,70,80,20, $BS_CENTER )
        $DiscUseSpaceInformation = GUICtrlCreateLabel ( "On local disc " & $DiscPath & " used " & $DiscUseSpacePercent & " % from total disc space",10,30,400,-1)
        HideShowWindow ( $MainWindow, $DiscInformationWindow )
        Do
        $msg = GUIGetMsg ( 1 )
        Until $msg[0] = $DiscInformationWindowOkButton
        HideShowWindow ( $DiscInformationWindow, $MainWindow )
EndFunc

Do
    $msg = GUIGetMsg ( 1 )
    Select
        Case $msg[0] = $ExportDataButton
            DiscInformation ()
        Case $msg[0] = $GUI_EVENT_CLOSE
            ExitProgram ($MainWindow)
    EndSelect
Until $Exit = 0

Share this post


Link to post
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
Sign in to follow this  
Followers 0