Jump to content

Transparent input control,


Uten
 Share

Recommended Posts

Does anyone of you know how to make a input control transparent?

I know that this only works with picture and label controls.

GUICtrlSetBkColor( $ctlID, $GUI_BKCOLOR_TRANSPARENT )

Any suggestions?

Link to comment
Share on other sites

Now, thats a cool tip @Zedna!

I know I can do it in API calls only (create my own text control), but it requires time I don't have at the moment. The sample by @Larry lacks editability, but it is a start.

But thanks a lot for it. It will come in handy..:)

Link to comment
Share on other sites

Hi,

I used a bodgey way to get an edit control to be transparent for one of my projects a while ago, only because I had no idea how to do it properly. It worked , but there must be an easier/proper way.

#include <GUIConstants.au3>

$main = GUICreate('Transparency', 200, 55, -1, -1, -1, $WS_EX_TOPMOST)
$Slider = GuiCtrlCreateSlider(5, 30, 190, 20,$TBS_NOTICKS + $TBS_BOTH)
GUICtrlSetLimit($Slider, 255, 1)
GUICtrlSetData($Slider, 255)
GUISetState()

$Child = GUICreate('Input', 188, 18, -1, -1, $WS_POPUP, $WS_EX_TOPMOST, $main)
$Input = GUICtrlCreateInput('Use slider to set transparency', -1, -1, 190, 20)
GUISetState()

$old = GUICtrlRead($Slider)

While 1
    $wpm = WinGetPos($main)
    $x = $wpm[0] + 9
    $y = $wpm[1] + 35
    WinMove($Child, "", $x, $y)
    If GUICtrlRead($Slider) <> $old Then 
        WinSetTrans($Child, "", GUICtrlRead($Slider))
        $old = GUICtrlRead($Slider)
    EndIf   
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd

Cheers

Link to comment
Share on other sites

hmm, that was odd. I have tried WinSetTrans several times (image control underneath) but it did not work at all. Conflicting style settings? I Don't know. Will have to try again. Thanks for the working sample @smashly..:)

Link to comment
Share on other sites

  • 7 months later...

what about this:

#include <GUIConstants.au3>

$main = GUICreate('Transparency', 200, 55, -1, -1, -1, $WS_EX_TOPMOST)
$Slider = GuiCtrlCreateSlider(5, 30, 190, 20,$TBS_NOTICKS + $TBS_BOTH)
$label = GUICtrlCreateLabel('Use slider to set transparency', 8,15, 190, 20)
GUICtrlSetLimit($Slider, 255, 1)
GUICtrlSetData($Slider, 255)
GUISetState()

$Child = GUICreate('Input', 188, 18, -1, -1, $WS_POPUP, $WS_EX_TOPMOST, $main)
$Input = GUICtrlCreateInput('Use slider to set transparency', -1, -1, 190, 20)
GUISetState()

$old = GUICtrlRead($Slider)
$in_old = GUICtrlRead($Input)

While 1
    if $in_old <> GUICtrlRead($Input) Then GUICtrlSetData($label, GUICtrlRead($Input))
    $in_old = GUICtrlRead($Input)
    $wpm = WinGetPos($main)
    $x = $wpm[0] + 9
    $y = $wpm[1] + 35
    WinMove($Child, "", $x, $y)
    If GUICtrlRead($Slider) <> $old Then
        WinSetTrans($Child, "", GUICtrlRead($Slider))
        $old = GUICtrlRead($Slider)
    EndIf   
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd
$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")
For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)
Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI"
Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;
MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
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...