Jump to content

set image transparent WinSetTrans??


epicfail
 Share

Recommended Posts

hi i have a slider in my script to change the transparent of my gui with WinSetTrans but how would i make it so that it only sets the transparent of the background image not the other images?

Try some experiments with _WinAPI_SetLayeredWindowAttributes(). See help file.

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

i cant find _WinAPI_SetLayeredWindowAttributes() in the help file

You need the latest Beta version or search the forums where you will find many copies of the function.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

#Include <GUIConstantsEx.au3>
#Include <WindowsConstants.au3>
#Include <WinAPIEx.au3>

$hForm = GUICreate('', 800, 600, -1, -1, $WS_POPUP)
GUICtrlCreatePic(@WindowsDir & '\Web\Wallpaper\Ascent.jpg', 0, 0, 800, 600, -1, $GUI_WS_EX_PARENTDRAG)

$hMain = GUICreate('', 800, 600, -1, -1, $WS_POPUP, $WS_EX_LAYERED, $hForm)
GUISetBkColor(0xABABAB)
GUICtrlCreateButton('OK', 365, 560, 70, 23)
GUICtrlCreateEdit('', 40, 40, 720, 503)

_WinAPI_SetLayeredWindowAttributes($hMain, 0xABABAB, 0, $LWA_COLORKEY)

GUIRegisterMsg($WM_MOVE, 'WM_MOVE')

WinSetTrans($hForm, '', 127)

GUISetState(@SW_SHOW, $hForm)
GUISetState(@SW_SHOW, $hMain)

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func WM_MOVE($hWnd, $iMsg, $wParam, $lParam)
    WinMove($hMain, '', BitAND($lParam, 0xFFFF), BitShift($lParam, 16))
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_MOVE

Link to comment
Share on other sites

epicfail, you could say thanks or something.

:D

Well, I liked your script! :D

Two minor changes though:

1. Requires standard WinAPI.au3 from Beta, not WinAPIEx.au3

2. $GUI_EVENT_CLOSE can't be used because there's not 'X' window control visible.

This runs (Beta) with the include fixed and the button used to close it:

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

$hForm = GUICreate('', 800, 600, -1, -1, $WS_POPUP)
GUICtrlCreatePic(@WindowsDir & '\Web\Wallpaper\Ascent.jpg', 0, 0, 800, 600, -1, $GUI_WS_EX_PARENTDRAG)

$hMain = GUICreate('', 800, 600, -1, -1, $WS_POPUP, $WS_EX_LAYERED, $hForm)
GUISetBkColor(0xABABAB)
$ctrlButton = GUICtrlCreateButton('CLOSE', 365, 560, 70, 23)
GUICtrlCreateEdit('', 40, 40, 720, 503)

_WinAPI_SetLayeredWindowAttributes($hMain, 0xABABAB, 0, $LWA_COLORKEY)

GUIRegisterMsg($WM_MOVE, 'WM_MOVE')

WinSetTrans($hForm, '', 127)

GUISetState(@SW_SHOW, $hForm)
GUISetState(@SW_SHOW, $hMain)

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $ctrlButton
            Exit
    EndSwitch
WEnd

Func WM_MOVE($hWnd, $iMsg, $wParam, $lParam)
    WinMove($hMain, '', BitAND($lParam, 0xFFFF), BitShift($lParam, 16))
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_MOVE

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Two minor changes though:

1. Requires standard WinAPI.au3 from Beta, not WinAPIEx.au3

2. $GUI_EVENT_CLOSE can't be used because there's not 'X' window control visible.

1. As I understood the OP does not work in Beta.

2. $GUI_EVENT_CLOSE also works when you press the ESC key (it just example).

:D

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...