Jump to content

Recommended Posts

hello everyone I would like through this script to have the possibility to increase or decrease the tgrasparenza at runtime or created something like this but I can not understand why it does not work, can someone know where I am wrong ? Thank you all 

#include <GuiconstantsEx.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3>
#include <GDIPlus.au3>

Global Const $SC_DRAGMOVE = 0xF012, $iGStepZoom=5
Global $a =255

HotKeySet("{ESC}", "On_Exit")
Func On_Exit()
    Exit
EndFunc   ;==>On_Exit

Global $hGUI = GUICreate("X", 943, 718, -1, -1, BitOR($WS_POPUP, $WS_BORDER), $WS_EX_TOPMOST)
$Pic1 = GUICtrlCreatePic("C:\paOK.jpg", 25, -1,950, 750)
$Button1 = GUICtrlCreateButton("\", 0, 0, 27, 25)
$Button2 = GUICtrlCreateButton("↓", 0, 23, 27, 25)
$Button3 = GUICtrlCreateButton("→", 0, 46, 27, 25)
$Checkbox1 = GUICtrlCreateCheckbox("inv", 0, 70, 33, 17)
GUISetState(@SW_SHOW)


While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_PRIMARYDOWN
            _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
        Case $Button1
            $WGP = WinGetPos($hGUI)
            If (GUICtrlRead($Checkbox1) = 1) Then
                WinMove($hGUI, "", Default, Default, $WGP[2] - $iGStepZoom, $WGP[3] - $iGStepZoom)
                 $a -=10
                WinSetTrans ( $hGUI, "", $a )
            Else
                WinMove($hGUI, "", Default, Default, $WGP[2] + $iGStepZoom, $WGP[3] + $iGStepZoom)
            EndIf
        Case $Button2
            $WGP = WinGetPos($hGUI)
            If (GUICtrlRead($Checkbox1) = 1) Then
                WinMove($hGUI, "", Default, Default, Default, $WGP[3] - $iGStepZoom)
            Else
                WinMove($hGUI, "", Default, Default, Default, $WGP[3] + $iGStepZoom)
            EndIf
        Case $Button3
            $WGP = WinGetPos($hGUI)
            If (GUICtrlRead($Checkbox1) = 1) Then
                WinMove($hGUI, "", Default, Default, $WGP[2] - $iGStepZoom, Default)
            Else
                WinMove($hGUI, "", Default, Default, $WGP[2] + $iGStepZoom, Default)
            EndIf

    EndSwitch
WEnd


func _picdim ($rp, $rp1, $rp2);$picture, $maxwidth, $maxheight
    _GDIPlus_Startup()
    $hImage = _GDIPlus_ImageLoadFromFile($rp)
    $Width = _GDIPlus_ImageGetWidth($hImage)
    $Height = _GDIPlus_ImageGetHeight($hImage)
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_Shutdown()
    $i = $rp1
    $xa = $Width / $rp1
    while $Height / $xa > $rp2
        $i -= 1
        $xa = $Width / $i
    wend
    $Width2 = $Width
    $Height2 = $Height
    if $Width > $rp1 or $Height > $rp2 then
        $Width2 = int($Width / $xa)
        $Height2 = int($Height / $xa)
    endif
    $Width3 = 0
    $Height3 = 0
    if int(($rp1 - $Width2) / 2) > 1 then $Width3 = int(($rp1 - $Width2) / 2)
    if int(($rp2 - $Height2) / 2) > 1 then $Height3 = int(($rp2 - $Height2) / 2)
endfunc

 

Link to post
Share on other sites

Your button1 seems wrong to me, maybe this :

Case $Button1
            $WGP = WinGetPos($hGUI)
            If GUICtrlRead($Checkbox1) = 1 Then
                WinMove($hGUI, "", Default, Default, $WGP[2] - $iGStepZoom, $WGP[3] - $iGStepZoom)
                 If $a > 10 Then $a -= 10
            Else
                WinMove($hGUI, "", Default, Default, $WGP[2] + $iGStepZoom, $WGP[3] + $iGStepZoom)
                If $a <= 245 Then $a += 10
            EndIf
            WinSetTrans ( $hGUI, "", $a )

 

Edited by Nine
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...