Jump to content

Recommended Posts

Posted
#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

Posted
#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

 

Posted
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

Posted
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

black.png

Posted

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

Posted
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 :)

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