Jump to content

Setting A Background Image


Recommended Posts

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!

Link to comment
Share on other sites

  • Moderators

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

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.

Link to comment
Share on other sites

  • Moderators

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

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.

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