Jump to content

[Solved]How to draw image on an other? (I want to create custom titlebar)


E1M1
 Share

Recommended Posts

I want to draw $Pic2 on $Pic1 so that both pictures would be visible. I also want $Pic2 to be clickable item. How do I do that?

I want to make my custom title bar where $Pic1 is background image and $Pic2 is close button

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 454, 192, 114)
$Pic1 = GUICtrlCreatePic(@ScriptDir&    "\2_Euro_Estland_2010.jpg", 232, 40, 169, 169, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Label1 = GUICtrlCreateLabel("Label1", 248, 48, 36, 17)
$Pic2 = GUICtrlCreatePic(@ScriptDir&"\bk.bmp", 344, 48, 52, 36, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS),$WS_EX_TOPMOST)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

    EndSwitch
WEnd

solution

GUICtrlSetState(-1,$GUI_ONTOP)

Edited by E1M1

edited

Link to comment
Share on other sites

$Pic2 is not wisible because of the $WS_CLIPSIBLINGS style. Why are you playing with them? Doesn't seem necessary based on the code you just posted. If you disable $Pic1 like the helpfile says the items in front can be clicked ;)

If a picture is set as a background picture, as the other controls will overlap, it's important to disable the pic control and create it after the others controls: GuiCtrlSetState(-1,$GUI_DISABLE).

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 454, 192, 114)
$Pic1 = GUICtrlCreatePic(@ScriptDir & "\blue.jpg", 232, 40, 169, 169)
GuiCtrlSetState(-1,$GUI_DISABLE)
$Label1 = GUICtrlCreateLabel("Label1", 248, 48, 36, 17)
$Pic2 = GUICtrlCreatePic(@ScriptDir & "\red.jpg", 344, 48, 52, 36)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Pic2
            ConsoleWrite(Random() & @CRLF)
    EndSwitch
WEnd

Another way:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 454, 192, 114)
$Label1 = GUICtrlCreateLabel("Label1", 248, 48, 36, 17)
$Pic2 = GUICtrlCreatePic(@ScriptDir & "\red.jpg", 344, 48, 52, 36)
$Pic1 = GUICtrlCreatePic(@ScriptDir & "\blue.jpg", 232, 40, 169, 169, $WS_CLIPSIBLINGS)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Pic2
            ConsoleWrite(Random() & @CRLF)
    EndSwitch
WEnd

Edit:

solution

GUICtrlSetState(-1,$GUI_ONTOP)

Meh :) Edited by AdmiralAlkex
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...