Jump to content

Transparent Labels


Recommended Posts

I am trying to create a desktop type program like windows. The icons move fine and function, but when I drag them over top each other, the label from the previous control is painted over top the label. Also, the gui

will have a background image and when I use the labels for the icons, the labels are black.

Can labels be see-thru? I've tried $WS_EX_TRANSPARENT

#include <GUIConstants.au3>

opt("Mousecoordmode",0)
opt("guioneventmode",1)

$Form2 = GUICreate("fdg", @DesktopWidth, @DesktopHeight, -1, -1, $WS_EX_TOOLWINDOW)
msgbox(0,"",@OSVersion)
$desktop = GUICtrlCreatePic("E:\Pictures\familyguy.bmp", 0,0,@desktopwidth, @desktopheight, 0)  
$Icon1 = GUICtrlCreateicon(@WindowsDir & "\system32\cmd.exe",0, 0, 0,32, 32, -1)
GUictrlsetonevent(-1,"Runit")
$Icon2 = GUICtrlCreateicon(@programfilesdir & "\Internet Explorer\IEXPLORE.EXE",0, 45, 0,32, 32, -1, $WS_EX_TRANSPARENT)
GUictrlsetonevent(-1,"runthis")
$icon1label = GUICtrlCreateLabel("Command",-10,35,50,20,$SS_CENTER,$WS_EX_TRANSPARENT)
GUICtrlSetColor(-1,0xffffff)
guictrlsetfont(-1, 7, 400, 0, "Terminal")
$icon2label = GUICtrlCreateLabel("Microsoft Internet Explorer",45,35,60,35,$SS_CENTER, $WS_EX_TRANSPARENT)
GUICtrlSetColor(-1,0xffffff)
guictrlsetfont(-1, 7, 400, 0, "Terminal")
GUISetState(@SW_SHOW)

While 1

        $get = GUIGetCursorInfo($form2)
        $iconpos2 = controlgetpos("fdg","",$icon2)
        $iconpos1 = controlgetpos("fdg","",$icon1)

        if not IsArray($get) Then
            continueloop

    elseif $get[3] = 1 Then
        movemode()
    
    endif

GUICtrlSetCursor($icon1, 0)
GUICtrlSetCursor($icon2, 0)
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;;;;;
    EndSelect
WEnd

Exit


func movemode()

    GUICtrlSetStyle($icon1label, $WS_EX_TRANSPARENT)
    GUICtrlSetStyle($icon2label, $WS_EX_TRANSPARENT)
$get = GUIGetCursorInfo($form2)
if $get[4] = $icon2 Then
    
    controlmove("fdg","",$icon2label,$get[0] - 30,$get[1] + 20)
    GUICtrlSetPos( $icon2, $get[0] - 15, $get[1] - 15)  


elseif $get[4] = $icon1 Then

    controlmove("fdg","",$icon1label,$get[0],$get[1] + 20)
    GUICtrlSetPos( $icon1, $get[0] - 15, $get[1] - 15)  

elseif not isarray($get) Then
    Return
endif
endfunc

func runit()
    GUICtrlSetColor($icon1label,0x000fff)
guictrlsetfont($icon1label, 7, 400, 4, "Terminal")
sleep(1000)
    GUICtrlSetColor($icon1label,0xffffff)
guictrlsetfont($icon1label, 7, 400, 0, "Terminal")
run("command.com")
    endfunc
    func runthis()
    GUICtrlSetColor($icon2label,0x000fff)
guictrlsetfont($icon2label, 7, 400, 4, "Terminal")
sleep(1000)
    GUICtrlSetColor($icon2label,0xffffff)
guictrlsetfont($icon2label, 7, 400, 0, "Terminal")
    run(@programfilesdir & "\Internet Explorer\IEXPLORE.EXE")
return
        endfunc
Edited by eynstyne
F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]
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...