Jump to content

Graphic and Picture can't overlap?


TheAutomator
 Share

Recommended Posts

Can someone please explain me why a graphic control can't overlap a picture?

My gui uses a background picture and a graphic that overlaps.

it doesn't matter what I try, the picture always overlaps the graphic control... 

this doesn't help either:

  • Graphic control can be clicked so they should not overlap with other controls. If overlap is needed it is important to disable the graphic control : GUICtrlSetState(-1, $GUI_DISABLE).

regards
 

Link to comment
Share on other sites

You can use GDI+ to draw first the background image and ontop the graphic drawings.

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Ok, i'll try that.

So its a no go for the graphic over image.

Is it ok that i post my script if it's not working? I never used GDI+ before...

[Edit:] wow, gdi has a lot of functions.

I don't even know what to use.. can you give me an example for drawing a background picture on a form please? :sweating: 

 

This is what i have, it this the correct way?

The width and height is not correct..

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

$Form = GUICreate("Form", 500, 300)
GUISetState(@SW_SHOW)

_GDIPlus_Startup()
    $FileGet = _GDIPlus_BitmapCreateFromFile('X.BMP')
    $BackDraw = _GDIPlus_GraphicsCreateFromHWND($Form)
    _GDIPlus_GraphicsDrawImage($BackDraw, $FileGet, 0, 0)

While True
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            _GDIPlus_GraphicsDispose($BackDraw)
            _GDIPlus_BitmapDispose($FileGet)
            _GDIPlus_Shutdown()
            Exit
    EndSwitch
WEnd

 

Regards

Edited by TheAutomator
Link to comment
Share on other sites

You can do something like this here to get the dimension of the image:

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

$sFile = FileOpenDialog("Select an image", "", "Image (*.jpg;*.bmp;*.png;*.gif)")
If @error Then Exit

_GDIPlus_Startup()
$hImage = _GDIPlus_BitmapCreateFromFile($sFile)
$iDimW = _GDIPlus_ImageGetWidth($hImage)
$iDimH = _GDIPlus_ImageGetHeight($hImage)
$Form = GUICreate("Form", $iDimW, $iDimH)
GUISetState(@SW_SHOW)

$hCanvas = _GDIPlus_GraphicsCreateFromHWND($Form)
_GDIPlus_GraphicsDrawImage($hCanvas, $hImage, 0, 0)
$hPen = _GDIPlus_PenCreate(0xFFFF0000, 18)
_GDIPlus_GraphicsDrawRect($hCanvas, 18, 18, $iDimW / 2, $iDimH / 2, $hPen)

While True
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            _GDIPlus_PenDispose($hPen)
            _GDIPlus_GraphicsDispose($hCanvas)
            _GDIPlus_BitmapDispose($hImage)
            _GDIPlus_Shutdown()
            Exit
    EndSwitch
WEnd

 

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Replace _GDIPlus_GraphicsDrawImage($hCanvas, $hImage, 0, 0) with _GDIPlus_GraphicsDrawImageRect($hCanvas, $hImage, 0, 0, $iDimW, $iDimH) and try again.

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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

×
×
  • Create New...