Jump to content

setting transparency with a transparent image


Recommended Posts

I've made a Gui that has transparent parts, I'd like to be able to set the parts that aren't transparent to have a translucent effect (partially see through)

However, when I change the transparency, the invisible parts of the Gui become visible.

Is there any easy way to fix this?

if you uncomment line 51 (WinSetTrans($hGUI, "", 100);set the gui transparency)

you will see what I'm talking about.

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <WinAPI.au3>
$numeProg = "Program Launcher"
$dll = DllOpen("user32.dll")
_Gadget_CreateGUI()
Func _Gadget_CreateGUI()
 $omap = @ScriptDir & "\Options.bmp"
 $omap2 = @ScriptDir & "\Options2.bmp"
 $bmap = @ScriptDir & "\Black.bmp"
 $but = @ScriptDir & "\BlackBut2.bmp"
 ;end color setting
 $hGUI = GUICreate($numeProg, 153, 170, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW, $WS_EX_ACCEPTFILES))
 $back = GUICtrlCreatePic($bmap, 0, 0, 128, 170, $WS_CLIPSIBLINGS)
 GUICtrlSetState($back, $GUI_DISABLE)
 ;creating the lists
 $ListView = GUICtrlCreateListView("col1|col2", 4, 27, 122, 107)
 GUICtrlSetStyle($ListView, BitOR($LVS_SMALLICON, $LVS_SINGLESEL), BitOR($LVS_EX_FLATSB, $LVS_EX_FULLROWSELECT))
 GUICtrlSetState($ListView, $GUI_DROPACCEPTED)
 GUICtrlSetFont($ListView, 7.3, 400, 0, "Arial");set the text font
 GUICtrlSetColor($ListView, 0xA6CAF0);set the text color
 GUICtrlSetBkColor($ListView, 0x000001)

 $tabbut1 = GUICtrlCreatePic($but, 2, 134, 61, 13, BitOR($SS_NOTIFY, $SS_BITMAP))
 $label1 = GUICtrlCreateLabel("Tab1", 6, 136, 54, 9, $SS_CENTER)
 GUICtrlSetFont($label1, 7.3, 400, 0, "Arial");set the text font
 GUICtrlSetColor($label1, 0xA6CAF0);set the text color
 GUICtrlSetBkColor($label1, 0x000001)
 GUICtrlSetState($label1, $GUI_SHOW)
 $map = GUICtrlCreatePic($omap, 128, 0, 25, 170, $WS_CLIPSIBLINGS)
 GUICtrlSetTip($map, "", "")
 GUICtrlSetCursor($map, 0)
 GUICtrlSetState($map, $GUI_DISABLE)
 GUICtrlSetState($map, $GUI_HIDE)
 $map2 = GUICtrlCreatePic($omap2, 128, 0, 25, 170, $WS_CLIPSIBLINGS)
 GUICtrlSetState($map2, $GUI_DISABLE)
 DllCall($dll, "int", "AnimateWindow", "hwnd", $hGUI, "int", 100, "long", 0x00040010);animate the gui
 GUISetState(@SW_SHOW, $hGUI);show the gui
 ;WinSetTrans($hGUI, "", 100);set the gui transparency
 $opflag = 0
 $closeflag = 0
 $conflag = 0
 $dragflag = 0
 While 1;start infinate loop
  Sleep(10);pause for 10 milliseconds
  $mpos = MouseGetPos();get mouse position
  $wpos = WinGetPos($hGUI)
  If $mpos[0] > $wpos[0] And $mpos[0] < $wpos[0] + $wpos[2] _
    And $mpos[1] > $wpos[1] And $mpos[1] < $wpos[1] + $wpos[3] _
    And $opflag = 0 And WinActive($numeProg) Then
   GUICtrlSetState($map2, $GUI_HIDE)
   GUICtrlSetState($map, $GUI_SHOW)
   $opflag = 1
  ElseIf $mpos[0] < $wpos[0] Or $mpos[0] > $wpos[0] + $wpos[2] _
    Or $mpos[1] < $wpos[1] Or $mpos[1] > $wpos[1] + $wpos[3] _
    And $opflag = 1 Then
   GUICtrlSetState($map, $GUI_HIDE)
   GUICtrlSetState($map2, $GUI_SHOW)
   $opflag = 0
  EndIf
  If $mpos[0] > $wpos[0] + $wpos[2] - 17 And $mpos[0] < $wpos[0] + $wpos[2] - 2 _
    And $mpos[1] > $wpos[1] - 2 And $mpos[1] < $wpos[1] + 17 And $closeflag = 0 And WinActive($numeProg) Then
   ToolTip("Close", $wpos[0] + $wpos[2] - 61, $wpos[1])
   $closeflag = 1
  ElseIf $mpos[0] < $wpos[0] + $wpos[2] - 17 Or $mpos[0] > $wpos[0] + $wpos[2] - 2 _
    Or $mpos[1] < $wpos[1] - 2 Or $mpos[1] > $wpos[1] + 17 And $closeflag = 1 Then
   ToolTip("")
   $closeflag = 0
  EndIf
  If $mpos[0] > $wpos[0] + $wpos[2] - 17 And $mpos[0] < $wpos[0] + $wpos[2] - 2 _
    And $mpos[1] > $wpos[1] + 21 And $mpos[1] < $wpos[1] + 40 And $conflag = 0 And WinActive($numeProg) Then
   ToolTip("Options", $wpos[0] + $wpos[2] - 74, $wpos[1] + 19)
   $conflag = 1
  ElseIf $mpos[0] < $wpos[0] + $wpos[2] - 17 Or $mpos[0] > $wpos[0] + $wpos[2] - 2 _
    Or $mpos[1] < $wpos[1] + 21 Or $mpos[1] > $wpos[1] + 40 And $conflag = 1 Then
   ToolTip("")
   $conflag = 0
  EndIf
  If $mpos[0] > $wpos[0] + $wpos[2] - 17 And $mpos[0] < $wpos[0] + $wpos[2] - 2 _
    And $mpos[1] > $wpos[1] + 42 And $mpos[1] < $wpos[1] + 59 And $dragflag = 0 And WinActive($numeProg) Then
   ToolTip("Drag", $wpos[0] + $wpos[2] - 57, $wpos[1] + 40)
   $dragflag = 1
  ElseIf $mpos[0] < $wpos[0] + $wpos[2] - 17 Or $mpos[0] > $wpos[0] + $wpos[2] - 2 _
    Or $mpos[1] < $wpos[1] + 42 Or $mpos[1] > $wpos[1] + 59 And $dragflag = 1 Then
   ToolTip("")
   $dragflag = 0
  EndIf
  Switch GUIGetMsg()
   Case $GUI_EVENT_PRIMARYDOWN
    If $mpos[0] > $wpos[0] + $wpos[2] - 19 And $mpos[0] < $wpos[0] + $wpos[2] _
      And $mpos[1] > $wpos[1] And $mpos[1] < $wpos[1] + 19 Then
     Exit
    EndIf
  EndSwitch
 WEnd
EndFunc   ;==>_Gadget_CreateGUI

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

Replace line 41 with this one

_WinAPI_SetLayeredWindowAttributes($hGUI, 0xFFFF33, 200)

and it should work.

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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