Sign in to follow this  
Followers 0
Jamie2312

Setting A Background Image

4 posts in this topic

Hey everyone!

I have made a program but for some reason the image that I want in the background is not allowing the buttons on the form to be pressed. Could someone please tell me the code to put an image in the background. Here is the code which I currently have:

$Pic1 = GUICtrlSetImage("E:\OP source\layout.jpg", 0, 0, 857, 623)

Thanks!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hey everyone!

I have made a program but for some reason the image that I want in the background is not allowing the buttons on the form to be pressed. Could someone please tell me the code to put an image in the background. Here is the code which I currently have:

$Pic1 = GUICtrlSetImage("E:\OP source\layout.jpg", 0, 0, 857, 623)

Thanks!

$Pic1 = GUICtrlSetImage("E:\OP source\layout.jpg", 0, 0, 857, 623)
GUICtrlSetState($Pic1, $GUI_DISABLE)
Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

$Pic1 = GUICtrlSetImage("E:\OP source\layout.jpg", 0, 0, 857, 623)
GUICtrlSetState($Pic1, $GUI_DISABLE)
When the background image is not in the folder, it does not load. Is there anyway in which the image can be used and not seen by the user? I could download it from a website address but this would take time to download.

Share this post


Link to post
Share on other sites

When the background image is not in the folder, it does not load. Is there anyway in which the image can be used and not seen by the user? I could download it from a website address but this would take time to download.

If you are compiling your program, you can use FileInstall('DirectPath to FileInstall FROM', 'Path to install to', [optional flag]), and then place it in the temp directory or something.

Example:

#include <GUICONSTANTS.AU3>

FileInstall('C:\MyPics\MyPic.jpg', @TempDir & '\2930fas09dfjw3fnm0.jpg', 1)

Opt('OnExitFunc', '_DeleteInstalledFiles')

$MainGUI = GUICreate('')
$Pic1 = GUICtrlCreatePic(@TempDir & '\2930fas09dfjw3fnm0.jpg', 0, 0, 857, 623)
GUICtrlSetState($Pic1, $GUI_DISABLE)

GUISetState()

While 1
    $GetGUIMSG = GUIGetMsg()
    If $GetGUIMSG = - 3 Then Exit
    Sleep(10)
WEnd

Func _DeleteInstalledFiles()
    FileDelete(@TempDir & '\2930fas09dfjw3fnm0.jpg')
EndFunc
***Note you can use OnAutoItExit() Function also instead of _DeleteInstalledFiles() or the Opt().

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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