Sign in to follow this  
Followers 0
E1M1

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

2 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

$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

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