Jump to content

Recommended Posts

Posted (edited)

Question:

I want to make a pic-control to change image like a checkbox state, checked or unchecked. And i don't know how to see if the pic- control was "checked" or not.

Edited by Mamba
Posted (edited)

It's a good question. I had the same Problem with a Icon in a button. Make behind the picture a button and disabled the pic

I have a map, is a disabled Pic control. And i want to make such thing. If i click on the city for ex, a "check" image apears, if i click again, a transparent pic is laoded instead of "check" image. I've tried to do this with a button with bitmap loaded but didnt work.

Edited by Mamba
Posted (edited)

#include <GUIConstants.au3>
Opt("GuiOnEventMode", 1)
Global $gui, $button, $true

Main_Gui()

While 1
     Sleep (10)
WEnd

Func Main_Gui()
    
    $gui = GUICreate("Background", 820, 615)
    $combo = GUICtrlCreateCombo("", 675, 5, 130, 15, 0x0003)
    GUICtrlSetData($combo, "Регион 3|Регион 4|Регион 5|Регион 6|Регион 7|Регион 8|Регион 9|Регион 12", "Регион 8")
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    GUISetState()


    $hGUI = GUICreate("", 665, 615, -1, -1, BitOR($WS_POPUP, $WS_VSCROLL, $WS_HSCROLL), BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui)

   $map = GUICtrlCreatePic(@ScriptDir & "\8\region8_2.jpg", 80, 0, 0, 0)
   ;507x607
    GuiCtrlSetState($map,$GUI_DISABLE)

    $button = GUICtrlCreatePic("none.jpg", 50, 50, 0, 0)
    GUICtrlSetOnEvent($button, "_Select")
    $true = False

    GUISetState()

EndFunc

Func _Select()
    
    If $true Then
        GUICtrlSetImage($button, "none.jpg")
    Else
        GUICtrlSetImage($button, "selected.jpg")
    EndIf
    
    $true = Not $true
    
EndFunc

Func _Exit()
    Exit 0
EndFunc

Edited by Mamba

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...