Jump to content

PNG Only GUI


jercfd
 Share

Recommended Posts

How can I make my GUI to only show PNGs and no default background. I still want it to be able to use regular controls.

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>

$hGUI = GUICreate("Show PNG", 240, 240, -1, -1, $WS_POPUP)
GUISetState(@SW_SHOW, $hGUI)

_GDIPlus_StartUp()
$hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Normal\top-left.png")
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
_GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0)

$hImage2 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Normal\top.png")
$hGraphic2 = _GDIPlus_GraphicsCreateFromHWND($hGUI)
_GDIPlus_GraphicsDrawImage($hGraphic2, $hImage2, 18, 0)

$hImage3 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Normal\top-right.png")
$hGraphic3 = _GDIPlus_GraphicsCreateFromHWND($hGUI)
_GDIPlus_GraphicsDrawImage($hGraphic2, $hImage3, 240-18, 0)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            _GDIPlus_GraphicsDispose($hGraphic)
            _GDIPlus_ImageDispose($hImage)
            _GDIPlus_GraphicsDispose($hGraphic2)
            _GDIPlus_ImageDispose($hImage2)
            _GDIPlus_GraphicsDispose($hGraphic3)
            _GDIPlus_ImageDispose($hImage3)
            _GDIPlus_ShutDown()
            Exit
    EndSwitch
WEnd
Link to comment
Share on other sites

Try this:

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>

$hGUI = GUICreate("Show PNG", 240, 240, -1, -1, $WS_POPUP)
$pic = GUICtrlCreatePic("", 0, 0, 240, 240)
GuiCtrlSetState(-1,$GUI_DISABLE)
$hpic = GUICtrlGetHandle($pic)
GUISetState(@SW_SHOW, $hGUI)

_GDIPlus_StartUp()
$hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Normal\top-left.png")
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hpic)
_GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0)

$hImage2 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Normal\top.png")
$hGraphic2 = _GDIPlus_GraphicsCreateFromHWND($hpic)
_GDIPlus_GraphicsDrawImage($hGraphic2, $hImage2, 18, 0)

$hImage3 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Normal\top-right.png")
$hGraphic3 = _GDIPlus_GraphicsCreateFromHWND($hpic)
_GDIPlus_GraphicsDrawImage($hGraphic2, $hImage3, 240-18, 0)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            _GDIPlus_GraphicsDispose($hGraphic)
            _GDIPlus_ImageDispose($hImage)
            _GDIPlus_GraphicsDispose($hGraphic2)
            _GDIPlus_ImageDispose($hImage2)
            _GDIPlus_GraphicsDispose($hGraphic3)
            _GDIPlus_ImageDispose($hImage3)
            _GDIPlus_ShutDown()
            Exit
    EndSwitch
WEnd
Edited by Zedna
Link to comment
Share on other sites

How would I use lod3n launcher to use multiple background images. Also, the top, bottom, and sides need to be dynamically sized from their original. For example, the top.png is 767px long and I want it sized to the current window size.

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