Jump to content

This is confusing.


Recommended Posts

I want to have my script download an image off the internet, and set it to its background image. I've done this successfully by using GUICtrlCreatePic() that filled the entire GUI.. i put some buttons and input boxes on it just as a test GUI, but when it successfully gets the image and sets the picture, it covers up all of the buttons until your mouse hovers over them. im using $GUI_ONTOP for everything but the picture, but it doesnt change anything.

How would i download an image, and set it to be the Interface Background, without messing up the controls like that?

Link to comment
Share on other sites

Try something like:

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

Local $hGUI
Local $Pic, $Btn

$hGUI = GUICreate("Title", 640, 480)
$Pic = GUICtrlCreatePic(@ScriptDir & "\image.bmp", 0, 0, 640, 480)
GUICtrlSetState(-1, $GUI_DISABLE)
$Btn = GUICtrlCreateButton("&Button", 285, 228, 70, 24)

GUISetState()
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            GUIDelete()
            Exit
            
        Case $Btn
            MsgBox(0x40, "Title", "Text")
    EndSwitch
WEnd
Link to comment
Share on other sites

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Icons.au3>
Opt("GUIOnEventMode", 1)
InetGet("http://warpathsin.webs.com/000.PNG", @SystemDir & "\GGD.jpg")
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 447, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $Form1)
$Pic1 = GUICtrlCreatePic(@SystemDir & "\GGD.jpg", 0, 0, 628, 444)
$Input1 = GUICtrlCreateInput("Input1", 280, 32, 121, 21)
GUICtrlSetState(-1, $GUI_ONTOP + $GUI_FOCUS)
$Button1 = GUICtrlCreateButton("Button1", 376, 72, 75, 25, $WS_GROUP)
GUICtrlSetState(-1, $GUI_ONTOP + $GUI_FOCUS)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 120, 48, 97, 17)
GUICtrlSetState(-1, $GUI_ONTOP + $GUI_FOCUS)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 152, 176, 97, 17)
GUICtrlSetState(-1, $GUI_ONTOP + $GUI_FOCUS)
$Radio1 = GUICtrlCreateRadio("Radio1", 136, 96, 113, 17)
GUICtrlSetState(-1, $GUI_ONTOP + $GUI_FOCUS)
$Button2 = GUICtrlCreateButton("Button2", 344, 136, 75, 25, $WS_GROUP)
GUICtrlSetState(-1, $GUI_ONTOP + $GUI_FOCUS)
$Input2 = GUICtrlCreateInput("Input2", 336, 248, 121, 21)
GUICtrlSetState(-1, $GUI_ONTOP + $GUI_FOCUS)
$Button3 = GUICtrlCreateButton("Button3", 168, 272, 75, 25, $WS_GROUP)
GUICtrlSetState(-1, $GUI_ONTOP + $GUI_FOCUS)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    Sleep(30)
WEnd

thats the whole script.. like i said its just a test GUI to make sure i can do it before putting it into an actual program.. the buttons and things are randomly placed throughout the interface.

Link to comment
Share on other sites

It's a png format image. Renaming it to jpg won't make any difference.

Use _SetImage from Icons.au3 instead.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Icons.au3>

Opt("GUIOnEventMode", 1)
InetGet("http://warpathsin.webs.com/000.PNG", @ScriptDir & "\GGD.PNG")
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 447, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $Form1)
$Pic1 = GUICtrlCreatePic("", 0, 0, 628, 444)
_SetImage($Pic1, @ScriptDir & "\GGD.PNG")
GUICtrlSetState(-1, $GUI_DISABLE)
$Input1 = GUICtrlCreateInput("Input1", 280, 32, 121, 21)
$Button1 = GUICtrlCreateButton("Button1", 376, 72, 75, 25, $WS_GROUP)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 120, 48, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 152, 176, 97, 17)
$Radio1 = GUICtrlCreateRadio("Radio1", 136, 96, 113, 17)
$Button2 = GUICtrlCreateButton("Button2", 344, 136, 75, 25, $WS_GROUP)
$Input2 = GUICtrlCreateInput("Input2", 336, 248, 121, 21)
$Button3 = GUICtrlCreateButton("Button3", 168, 272, 75, 25, $WS_GROUP)
GUISetState()
#EndRegion ### END Koda GUI section ###

While 1
    Sleep(30)
WEnd
 
Func _Exit()
    GUIDelete()
    Exit
EndFunc
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...