Jump to content

Creating a Picture in the background


shavenh
 Share

Recommended Posts

Hi,

I'm trying to get a form with a GuictrlcreatePic in the background and buttons on top (in the foreground),

this works, except when i hide and then display the gui, some of the buttons visually dissappear (they reappear if you move you mouse over them)

the only fudge/ workaround is to delete the form and redraw the gui

is there a cleaner better way??

many thanks

Link to comment
Share on other sites

Note the GUICtrlSetState in the example below (used beta for this example):

#include <GUIConstants.au3>

; Find a picture to use as Gui background.
Global $picture
If FileChangeDir(@WindowsDir & '\Web\Wallpaper') Then
    $handle = FileFindFirstFile('*.jpg')
    If $handle <> -1 Then
        $picture = FileFindNextFile($handle)
        FileClose($handle)
    EndIf
EndIf

; Setup the Gui
$title = 'Test Background with AutoIt ' & FileGetVersion(@AutoItExe)
$handle = GUICreate($title, 320, 240)
If FileExists($picture) Then
    GUICtrlCreatePic($picture, 0, 0, 320, 240)
    GUICtrlSetState(Default, $GUI_DISABLE)
Else
    MsgBox(0, '', 'A picture was not found to test with in ' & @WorkingDir)
    Exit
EndIf
$button = GUICtrlCreateButton("test",10,10)

GuiSetState()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
WEnd
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

THANKS

looks good, will put the bit of code into my program,

> GUICtrlSetState(Default, $GUI_DISABLE)

how does this fix it? or is the new beta making it work better?

disabling the pic stops it from accepting clicks, etc...

Not new to beta, just looked it up in the release help, so should work with release also.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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