Jump to content
Sign in to follow this  
Champak

Transparency level on labels/gamma on images

Recommended Posts

Champak

I redid this post so it is a little clearer, solution preferences are in order.

1/ Is there a way to change the gamma level of an image?

2/ Is it possible to change the transparency level on a label like winsettrans? If not, is there some type of manipulation or workaround to achieve this?

3/ If those aren't possible, can I layer a gui on top my main gui, set that top gui to a certain level of transparency (NOT fully transparent), and click through it?

Edited by Champak

Share this post


Link to post
Share on other sites
Champak

So are my questions not possible or just unknown?

Share this post


Link to post
Share on other sites
ChrisL

I redid this post so it is a little clearer, solution preferences are in order.

1/ Is there a way to change the gamma level of an image?

2/ Is it possible to change the transparency level on a label like winsettrans? If not, is there some type of manipulation or workaround to achieve this?

3/ If those aren't possible, can I layer a gui on top my main gui, set that top gui to a certain level of transparency (NOT fully transparent), and click through it?

1 Have a look at ImageMagic control with COM http://www.autoitscript.com/forum/index.php?showtopic=49065

2 Try $hwnd = ControlGetHandle ( "title", "text", controlID ) then once you have a Handle to the control see if you can use WinSetTrans($hwnd) (use $hwnd = GUICtrlGetHandle ( controlID ) if it's an AutoIt self made gui) Maybe???

Share this post


Link to post
Share on other sites
Champak

Thanks, the ImageMagic did the trick.

Share this post


Link to post
Share on other sites
ChrisL

I had more time to play with transparent labels, my suggested method above wont work as you probably know already.

See below code, You have to set a transparency level for each child gui which has controls in it or you won't see it at all!

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



Local $gui, $background, $msg
        
    $gui = GUICreate("Background", 400, 100)
; background picture
    $background = GUICtrlCreatePic(@SystemDir & "\oobe\images\mslogo.jpg", 0, 0, 400, 100)
    GUISetState(@SW_SHOW)

; transparent child window
    $LabelGui = GUICreate("", 120, 20, 260, 70, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_MDICHILD, $gui)
    $label = GUICtrlCreateLabel("Transparent label",0,0,120,20)

    GUISetState(@SW_SHOW)
    
    For $i = 1 to 255
        WinSetTrans($LabelGui,"",$i);You have to set a transparency regardless or the gui will be fully transparent and you wont see the label
        Sleep (5)
    Next
    For $i = 255 to 150 Step -1
        WinSetTrans($LabelGui,"",$i)
        Sleep (5)
    Next
    
    
    Do
        $msg = GUIGetMsg()

    Until $msg = $GUI_EVENT_CLOSE
Edited by ChrisL

Share this post


Link to post
Share on other sites
ChrisL

Simplified as a UDF

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

Local $gui, $background, $msg
        
    $gui = GUICreate("Background", 400, 100)
; background picture
    $background = GUICtrlCreatePic(@SystemDir & "\oobe\images\mslogo.jpg", 0, 0, 400, 100)
    GUISetState(@SW_SHOW)

    $label = _TransparentLabel($Gui,"Transparent label",260, 70,120, 20)
    GUISetState(@SW_SHOW)

    
    Do
        $msg = GUIGetMsg()
        
        If $msg = $Label[1] then Msgbox(0,"","You clicked the label")
        
    Until $msg = $GUI_EVENT_CLOSE


Func _TransparentLabel($GuiHwnd,$vText,$iXpos,$iYpos,$iWidth,$iHeight,$iStyle=-1,$iExtended=-1,$iTrans=150)
    
    Local $ret[2]
    $ret[0] = GUICreate("", $iWidth, $iHeight, $iXpos, $iYpos, 0x80000000, 0x00080000 + 0x00000040, $GuiHwnd)
    $ret[1] = GUICtrlCreateLabel($vText,0,0,$iWidth,$iHeight,$iStyle,$iExtended)
    GUISetState(@SW_SHOW,$Ret[0])
    WinSetTrans($Ret[0],"",$iTrans)
    Return $ret
    
EndFunc

Edit: Included Styles option

Edited by ChrisL

Share this post


Link to post
Share on other sites
Champak

Yeah, I've tried the transparent gui before, but that wont work for my needs. Thanks anyway. However, I am having a problem with registering the imagemagick dll. Did you use it, or you just came across it and pointed it out to me? If you did use it, did you use the compiled script on a different computer successfully? You can check out my post in the thread you pointed out to me.

Thanks.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.