Jump to content
Sign in to follow this  
extraloob

Backround Image

Recommended Posts

extraloob

I want to add backround image my gui.

I try it but old buttons,labels etc. were hidden.

How do it?

Share this post


Link to post
Share on other sites
sandin

this takes your desktop background image, or change $picture to some other picture location...

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

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 800, 600)
$picture = GUICtrlCreatePic(@UserProfileDir & "\Local Settings\Application Data\Microsoft\Wallpaper1.bmp", 0, 0, 800, 600)
GUICtrlSetState(-1, $GUI_DISABLE)
$Button1 = GUICtrlCreateButton("Button1", 16, 336, 121, 33, -1, $WS_EX_TRANSPARENT)
$Input1 = GUICtrlCreateInput("Input1", 16, 8, 177, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
Edited by sandin

Share this post


Link to post
Share on other sites
Melba23

extraloob,

DO NOT DOUBLE POST IN DIFFERENT FORA

I have already answered you in GUI help.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Israelguy

Hi,

I want to change the desktop pic at a remote computer in my LAN.

I know i can replace the "Wallpaper1.bmp" file with the desired one.

The question is, how I make the remote desktop background refresh itself?

tnx

Share this post


Link to post
Share on other sites
KaFu

Tweak from helpfile.

Problem: Most controls can not be set to use a transparent background ($GUI_BKCOLOR_TRANSPARENT), thus would have a grey frame.

Work-around: Draw a disabled colored label where you want to place controls as background for these controls.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <WinAPI.au3>

Global $hGUI, $hImage, $hGraphic, $hImage1

; Create GUI
$hGUI = GUICreate("Show PNG", 350, 300)

; Load PNG image
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile("background.png")
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)

GUICtrlCreateLabel("", 5, 5, 100, 40)
GUICtrlSetBkColor(-1, 0xffffff)
GUICtrlSetState(-1, $GUI_DISABLE)

GUICtrlCreateCheckbox("Test", 10, 10)
GUICtrlSetBkColor(-1, 0xffffff)

GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT")

GUISetState()

Do

Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()

; Draw PNG image
Func MY_WM_PAINT($hWnd, $Msg, $wParam, $lParam)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 0, 0, _GDIPlus_ImageGetWidth($hImage), _GDIPlus_ImageGetHeight($hImage))
    Return $GUI_RUNDEFMSG
EndFunc  ;==>MY_WM_PAINT

Share this post


Link to post
Share on other sites
Israelguy

is the answer for my question?

Share this post


Link to post
Share on other sites
Melba23

Israelguy,

No, that is an answer for the OP.

Now, welcome to AutoIt and these forums.

But please do try and obey the rules, one of which is - Do not hijack threads. If you have a question to ask, start a new thread. Otherwise it can get very confusing. ;-)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Israelguy

Israelguy,

No, that is an answer for the OP.

Now, welcome to AutoIt and these forums.

But please do try and obey the rules, one of which is - Do not hijack threads. If you have a question to ask, start a new thread. Otherwise it can get very confusing. ;-)

M23

Hi M23,

Sorry I'm new. I thought that in like other forums the taget is to reduct as much the threads.

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  

×