legend Posted September 24, 2018 Posted September 24, 2018 #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 437, 192, 124) $Group1 = GUICtrlCreateGroup("", 120, 56, 89, 73) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Is it possible to hide the box that is around the group? I have a transparent png picture inside the group box, but i would like to hide the square box around the group
FrancescoDiMuro Posted September 24, 2018 Posted September 24, 2018 @legend Use GUICtrlCreatePic() instead of GUICtrlCreateGroup() Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
Zedna Posted September 24, 2018 Posted September 24, 2018 #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 437, 192, 124) $Group1 = GUICtrlCreateGroup("", 120, 56, 89, 73) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button_hide = GUICtrlCreateButton("Hide Group", 120, 256, 100, 20) $Button_show = GUICtrlCreateButton("Show Group", 120, 306, 100, 20) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button_hide GUICtrlSetState($Group1,$GUI_HIDE) Case $Button_show GUICtrlSetState($Group1,$GUI_SHOW) EndSwitch WEnd Resources UDF ResourcesEx UDF AutoIt Forum Search
legend Posted September 24, 2018 Author Posted September 24, 2018 (edited) . Edited September 24, 2018 by legend
legend Posted September 24, 2018 Author Posted September 24, 2018 49 minutes ago, Zedna said: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 437, 192, 124) $Group1 = GUICtrlCreateGroup("", 120, 56, 89, 73) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button_hide = GUICtrlCreateButton("Hide Group", 120, 256, 100, 20) $Button_show = GUICtrlCreateButton("Show Group", 120, 306, 100, 20) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button_hide GUICtrlSetState($Group1,$GUI_HIDE) Case $Button_show GUICtrlSetState($Group1,$GUI_SHOW) EndSwitch WEnd If I hide the control, the picture will be hidden as well
Zedna Posted September 24, 2018 Posted September 24, 2018 4 hours ago, legend said: If I hide the control, the picture will be hidden as well Then use method posted by FrancescoDiMuro in his reaction in this topic. Resources UDF ResourcesEx UDF AutoIt Forum Search
legend Posted September 24, 2018 Author Posted September 24, 2018 16 minutes ago, Zedna said: Then use method posted by FrancescoDiMuro in his reaction in this topic. I haven't found a way to do that, Here's my example: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <SendMessage.au3> #include <GDIPlus.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 677, 333, 192, 124) $Group1 = GUICtrlCreateGroup("", 56, 32, 240, 242, BitOR($BS_BITMAP, $BS_CENTER)) PngOnControl("black.png",$Group1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd func PngOnControl($picture, $control) _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile($picture) $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($control), $BM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap)) EndFunc try replace GUICtrlCreateGroup with GUICtrlCreatePic, it won't work
Zedna Posted September 24, 2018 Posted September 24, 2018 This fixed code should work (with valid image): #include <Constants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <SendMessage.au3> #include <GDIPlus.au3> Global Const $STM_SETIMAGE = 0x0172 #region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 677, 333, 192, 124) ;~ $Group1 = GUICtrlCreateGroup("", 56, 32, 240, 242, BitOR($BS_BITMAP, $BS_CENTER)) ;~ PngOnControl("black.png", $Group1) $Pic1 = GUICtrlCreatePic("", 56, 32, 240, 242, BitOr($GUI_SS_DEFAULT_PIC, $SS_BITMAP)) PngOnControl("black.png", $Pic1) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func PngOnControl($picture, $control) _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile($picture) $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) ;~ _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($control), $BM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap)) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($control), $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap)) EndFunc For working code doing the same look at my Resources UDF (_ResourceSetImageToCtrl(),_SetBitmapToCtrl()), link is in my signature ... Resources UDF ResourcesEx UDF AutoIt Forum Search
legend Posted September 25, 2018 Author Posted September 25, 2018 13 hours ago, Zedna said: This fixed code should work (with valid image): #include <Constants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <SendMessage.au3> #include <GDIPlus.au3> Global Const $STM_SETIMAGE = 0x0172 #region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 677, 333, 192, 124) ;~ $Group1 = GUICtrlCreateGroup("", 56, 32, 240, 242, BitOR($BS_BITMAP, $BS_CENTER)) ;~ PngOnControl("black.png", $Group1) $Pic1 = GUICtrlCreatePic("", 56, 32, 240, 242, BitOr($GUI_SS_DEFAULT_PIC, $SS_BITMAP)) PngOnControl("black.png", $Pic1) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func PngOnControl($picture, $control) _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile($picture) $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) ;~ _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($control), $BM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap)) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($control), $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap)) EndFunc For working code doing the same look at my Resources UDF (_ResourceSetImageToCtrl(),_SetBitmapToCtrl()), link is in my signature ... Thank's a lot zedna, that works perfect
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now