Sign in to follow this  
Followers 0
kklee69

ChrisL's translucent button UDF use problems

1 post in this topic

#1 ·  Posted (edited)

I'm looking for a translucent button
I found a UDF here

It's a great UDF, but I'm having problems with it.
Can you help me with my problem?

Question one

When the GUI is minimized and then restored, you can see that the LISTVIEW location is different

 

Question two

You can see the pattern of the location of chaos out
Because added  BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SYSMENU, $WS_GROUP, $WS_TABSTOP)

So the location will be confused

Look at my pictures


Here is MY CODE

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

   ; GUICreate("LISTVIEW", 220, 250, 100, 200, -1, $WS_EX_ACCEPTFILES)
    GUICreate("LISTVIEW", 220, 250, 100, 200, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SYSMENU, $WS_GROUP, $WS_TABSTOP))
    
    GUISetBkColor(0x00E0FFFF) ; 

    Local $idListview = GUICtrlCreateListView("T 1  |T 2|T 3  ", 10, 10, 200, 150) ;,$LVS_SORTDESCENDING)
    _GuiCtrlMakeTrans(-1,100)
    Local $idButton = GUICtrlCreateButton("TEST", 75, 170, 70, 20)
    Local $idItem1 = GUICtrlCreateListViewItem("A2|col22|col23", $idListview)
    Local $idItem2 = GUICtrlCreateListViewItem("A1|B2|B3", $idListview)
    Local $idItem3 = GUICtrlCreateListViewItem("A3|col32|col33", $idListview)
    GUICtrlCreateInput("", 20, 200, 150)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED) ;
    GUISetState(@SW_SHOW)


   
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

            Case $idButton
               

            Case $idListview
               

        EndSwitch
    WEnd



Func _GuiCtrlMakeTrans($iCtrlID,$iTrans=255)
    
    Local $pHwnd, $nHwnd, $aPos, $a
    
    $hWnd = GUICtrlGetHandle($iCtrlID);Get the control handle
    If $hWnd = 0 then Return SetError(1,1,0) 
    $pHwnd = DllCall("User32.dll", "hwnd", "GetParent", "hwnd", $hWnd);Get the parent Gui Handle
    If $pHwnd[0] = 0 then Return SetError(1,2,0)
    $aPos = ControlGetPos($pHwnd[0],"",$hWnd);Get the current pos of the control
    If @error then Return SetError(1,3,0)
    $nHwnd = GUICreate("", $aPos[2], $aPos[3], $aPos[0], $aPos[1], 0x80000000, 0x00080000 + 0x00000040, $pHwnd[0]);greate a gui in the position of the control
    If $nHwnd = 0 then Return SetError(1,4,0)
    $a = DllCall("User32.dll", "hwnd", "SetParent", "hwnd", $hWnd, "hwnd", $nHwnd);change the parent of the control to the new gui
    If $a[0] = 0 then Return SetError(1,5,0)
    If NOT ControlMove($nHwnd,'',$hWnd,0,0) then Return SetError(1,6,-1);Move the control to 0,0 of the newly created child gui
    GUISetState(@SW_Show,$nHwnd);show the new child gui
    WinSetTrans($nHwnd,"",$iTrans);set the transparency
    If @error then Return SetError(1,7,0)
    GUISwitch($pHwnd[0]);switch back to the parent Gui
    
    Return $nHwnd;Return the handle for the new Child gui
    
EndFunc

 

未命名.jpg

未命名2.jpg

Edited by kklee69

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  
Followers 0