Jump to content

Graphic on top of label?


Recommended Posts

Hi im having a problem , I somehow feel that im not the first one that have had this but couldn't easily find  similar situation by searching.

I want a $hGraphic to be placed on top of a label is that possible ? 

 

Here is my demo code which dosent work

#include <GUIConstantsEx.au3>
    $hWin = GUICreate("Test", 200, 200)
      Local $hLabel = GUICtrlCreateLabel("", 1, 1, 198, 198)
        GUICtrlSetBkColor(-1, 0x875327)
        GUICtrlSetState(-1, $GUI_DISABLE)
$hGraphic = GUICtrlCreateGraphic(50, 50 , 21, 21)
GUICtrlSetBkColor(-1, 0x00FF00)
GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xFF0000, 0xFF0000)
GUICtrlSetGraphic(-1, $GUI_GR_PIE, 10, 10, 10, 0, 360)
    GUISetState()
    While 1
        $iMsg = GUIGetMsg()
        Switch $iMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hGraphic
            Local $aInfo = GUIGetCursorInfo($hWin)
            $iOldPCM = Opt("PixelCoordMode", 2)
            Local $iColour = PixelGetColor($aInfo[0], $aInfo[1], $hWin)
            Opt("PixelCoordMode", $iOldPCM)
            If $iColour = 0xff0000 Then MsgBox(0, "", "Hit")
    EndSwitch
    WEnd

 

Any help would be much appreciated 

Link to comment
Share on other sites

Here one way :

#include <GUIConstants.au3>
$hWin = GUICreate("Test", 200, 200)
GUICtrlCreateLabel("", 1, 1, 198, 198)
GUICtrlSetBkColor(-1, 0x875327)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState()

GUICreate ("", 21, 21, 50, 50, $WS_POPUP, $WS_EX_MDICHILD, $hWin)
$hGraphic = GUICtrlCreateGraphic(0, 0, 21, 21)
GUICtrlSetBkColor(-1, 0x00FF00)
GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xFF0000, 0xFF0000)
GUICtrlSetGraphic(-1, $GUI_GR_PIE, 10, 10, 10, 0, 360)
GUISetState()

While 1
  $iMsg = GUIGetMsg()
  Switch $iMsg
    Case $GUI_EVENT_CLOSE
      Exit
    Case $hGraphic
      Local $aInfo = GUIGetCursorInfo($hWin)
      $iOldPCM = Opt("PixelCoordMode", 2)
      Local $iColour = PixelGetColor($aInfo[0], $aInfo[1], $hWin)
      Opt("PixelCoordMode", $iOldPCM)
      If $iColour = 0xff0000 Then MsgBox(0, "", "Hit")
  EndSwitch
WEnd

 

Link to comment
Share on other sites

Thanks for your reply and it does indeed work :) Im trying to tinker a bit with it, How do I alter the background color of this line

GUICreate ("", 21, 21, 50, 50, $WS_POPUP, $WS_EX_MDICHILD, $hWin)

 

Link to comment
Share on other sites

I worked with this for a little hour now , and I tried using "Webdings" font as an alternate way to make a circle which I found a little better for me..  In one day I went from having 0 solutions into two different techniques -;)  Thanks a bunch 

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