Ränder transparent machen?

  • Hallo Mitglieder.

    Ich habe mich in der letzten Zeit so sehr mit AutoIt beschäftigt,
    dabei habe ich die GUI ganz vergessen.

    Ich wollte daher fragen, ob es möglich ist die weißen Ränder von Buttons, Bars etc. transparent zu machen.

    Da ich bei meinen Grafiken immer ein weißes Feld habe, damit die Ränder nicht auffallen, was jedoch unschön aussieht.

    Mit freundlichem Gruß
    Aldeos

  • Bei mir entsteht kein Rand um die Buttons, evtl liegt das an deinem Windows Style (Hast du XP?)
    False es dir hilft, mit dem Bfehl GuiCtrlSetBkColor kannst du die Control Farbe ändern.

  • Nein, ich habe Windows 7 Ultimate 64Bit.

    Der Rand entsteht ja erst, sobal ich z.B. einen schwarzen Hintergrund (Grafik) habe, die Buttons aber standartgemäß lasse.

  • Hallo DaisukeHideki,

    das kannst du leider nicht verhindern, siehe:

    Beispiel
    [autoit]

    ;#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
    #include <GUIConstantsEx.au3>
    #include <GuiButton.au3>
    #include <GuiImageList.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt("MustDeclareVars", 1)

    [/autoit] [autoit][/autoit] [autoit]

    _Main()

    [/autoit] [autoit][/autoit] [autoit]

    Func _Main()
    Local $sBMPNormal = @ScriptDIR & "\Icons\dsFirst_NORMAL.BMP"
    Local $sBMPHot = @ScriptDir & "\Icons\dsFirst_mouseover.bmp"
    Local $sBMPPress = @ScriptDir & "\Icons\dsFirst_mousedown.bmp"
    Local $sBMPImage = @WindowsDir & "\pchealth\helpctr\System\blurbs\watermark_300x.bmp"
    Local $btn1, $btn2, $btn3, $btn4, $msg
    Local $hImagebtn1, $hImagebtn2, $hImagebtn3 ,$hImagebtn4

    [/autoit] [autoit][/autoit] [autoit]

    ;Caveat: Minimum Operating Systems: Windows XP.

    [/autoit] [autoit][/autoit] [autoit]

    ;Image list with multiple images will only show the images
    ;other than the 1st image when Themes are used.

    [/autoit] [autoit][/autoit] [autoit]

    Local $hGUI = GUICreate("Button Imagelists - Minimum OS: Windows XP",400,300)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreatePic(@WindowsDir & "\Web\Wallpaper\Windows XP.jpg", 0, 0, 400, 300)
    GUICtrlSetState(-1, $GUI_DISABLE)

    [/autoit] [autoit][/autoit] [autoit]

    ;multi state image Bitmap
    $btn1 = GUICtrlCreateButton("This Way", 30, 30, 90, 32)
    GUICtrlSetTip(-1, "Multi state bitmap imagelist")
    $hImagebtn1 = _GUIImageList_Create(24, 24, 3, 3)
    _GUIImageList_AddBitmap($hImagebtn1, $sBMPNormal);1 - Normal
    _GUIImageList_AddBitmap($hImagebtn1, $sBMPHot) ;2 - Hot
    _GUIImageList_AddBitmap($hImagebtn1, $sBMPPress) ;3 - Pressed
    _GUIImageList_AddBitmap($hImagebtn1, $sBMPPress);4 - Disabled
    _GUIImageList_AddBitmap($hImagebtn1, $sBMPNormal);5 - Defaulted
    _GUIImageList_AddBitmap($hImagebtn1, $sBMPNormal);6 - Stylus Hot (tablet computers only)
    _GUICtrlButton_SetImageList($btn1, $hImagebtn1)
    ;#cs
    ;single state image Bitmap
    $btn2 = GUICtrlCreateButton("This Way", 30, 70, 90, 32)
    GUICtrlSetTip(-1, "Single bitmap imagelist")
    $hImagebtn2 = _GUIImageList_Create(24, 24, 5, 3)
    _GUIImageList_AddBitmap($hImagebtn2, $sBMPNormal);1 - Normal
    _GUICtrlButton_SetImageList($btn2, $hImagebtn2)
    ;#ce
    ;single state image Icon
    $btn3 = GUICtrlCreateButton("Unlock", 30, 110, 90, 40)
    GUICtrlSetTip(-1, "Single icon imagelist")
    $hImagebtn3 = _GUIImageList_Create(32, 32, 5, 3)
    _GUIImageList_AddIcon($hImagebtn3, "msrating.dll", 10, True)
    _GUICtrlButton_SetImageList($btn3, $hImagebtn3)

    [/autoit] [autoit][/autoit] [autoit]

    ;single state image Bitmap with overlayed text
    $btn4 = GUICtrlCreateButton("Help", 30, 160, 90, 90)
    GUICtrlSetTip(-1, "Single bitmap imagelist with overlayed text")
    GUICtrlSetFont(-1, 14, 800, -1, "Comic Sans MS")
    $hImagebtn4 = _GUIImageList_Create(80, 80, 5, 3)
    _GUIImageList_AddBitmap($hImagebtn4, $sBMPImage)
    _GUICtrlButton_SetImageList($btn4, $hImagebtn4, 4)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $btn1
    Case $btn2
    GUICtrlSetState($btn1, $GUI_DISABLE)
    Case $btn3
    GUICtrlSetState($btn1, $GUI_ENABLE)
    Case $btn4
    EndSwitch
    WEnd
    EndFunc ;==>_Main

    [/autoit] [autoit][/autoit] [autoit][/autoit]

    du kannst es nur etwas abmildern:

    mit Hilfsgui je Button
    [autoit]

    ; *** Start added by AutoIt3Wrapper ***
    #include <WindowsConstants.au3>
    ; *** End added by AutoIt3Wrapper ***
    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_Add_Constants=n
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    ;#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
    #include <GUIConstantsEx.au3>
    #include <GuiButton.au3>
    #include <GuiImageList.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt("MustDeclareVars", 1)

    [/autoit] [autoit][/autoit] [autoit]

    _Main()

    [/autoit] [autoit][/autoit] [autoit]

    Func _Main()
    Local $sBMPNormal = @ScriptDIR & "\Icons\dsFirst_NORMAL.BMP"
    Local $sBMPHot = @ScriptDir & "\Icons\dsFirst_mouseover.bmp"
    Local $sBMPPress = @ScriptDir & "\Icons\dsFirst_mousedown.bmp"
    Local $sBMPImage = @WindowsDir & "\pchealth\helpctr\System\blurbs\watermark_300x.bmp"
    Local $btn1, $btn2, $btn3, $btn4, $msg
    Local $hImagebtn1, $hImagebtn2, $hImagebtn3 ,$hImagebtn4

    [/autoit] [autoit][/autoit] [autoit]

    ;Caveat: Minimum Operating Systems: Windows XP.

    [/autoit] [autoit][/autoit] [autoit]

    ;Image list with multiple images will only show the images
    ;other than the 1st image when Themes are used.

    [/autoit] [autoit][/autoit] [autoit]

    Local $hGUI = GUICreate("Button Imagelists - Minimum OS: Windows XP",400,300)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreatePic(@WindowsDir & "\Web\Wallpaper\Windows XP.jpg", 0, 0, 400, 300)
    GUICtrlSetState(-1, $GUI_DISABLE)
    Local $hChild1 = GUICreate("Child",90,32,30,30, $WS_POPUP, BitOR($WS_EX_MDICHILD, $WS_EX_ACCEPTFILES), $hGUI)
    ;multi state image Bitmap
    $btn1 = GUICtrlCreateButton("This Way", 0, 0, 90, 32)
    GUICtrlSetTip(-1, "Multi state bitmap imagelist")
    $hImagebtn1 = _GUIImageList_Create(24, 24, 3, 3)
    _GUIImageList_AddBitmap($hImagebtn1, $sBMPNormal);1 - Normal
    _GUIImageList_AddBitmap($hImagebtn1, $sBMPHot) ;2 - Hot
    _GUIImageList_AddBitmap($hImagebtn1, $sBMPPress) ;3 - Pressed
    _GUIImageList_AddBitmap($hImagebtn1, $sBMPPress);4 - Disabled
    _GUIImageList_AddBitmap($hImagebtn1, $sBMPNormal);5 - Defaulted
    _GUIImageList_AddBitmap($hImagebtn1, $sBMPNormal);6 - Stylus Hot (tablet computers only)
    _GUICtrlButton_SetImageList($btn1, $hImagebtn1)
    ;#cs
    Local $hChild2 = GUICreate("Child",90,32,30,70, $WS_POPUP, BitOR($WS_EX_MDICHILD, $WS_EX_ACCEPTFILES), $hGUI)
    ;single state image Bitmap
    $btn2 = GUICtrlCreateButton("This Way", 0, 0, 90, 32)
    GUICtrlSetTip(-1, "Single bitmap imagelist")
    $hImagebtn2 = _GUIImageList_Create(24, 24, 5, 3)
    _GUIImageList_AddBitmap($hImagebtn2, $sBMPNormal);1 - Normal
    _GUICtrlButton_SetImageList($btn2, $hImagebtn2)
    ;#ce
    Local $hChild3 = GUICreate("Child",90,40,30,110, $WS_POPUP, BitOR($WS_EX_MDICHILD, $WS_EX_ACCEPTFILES), $hGUI)
    ;single state image Icon
    $btn3 = GUICtrlCreateButton("Unlock", 0, 0, 90, 40)
    GUICtrlSetTip(-1, "Single icon imagelist")
    $hImagebtn3 = _GUIImageList_Create(32, 32, 5, 3)
    _GUIImageList_AddIcon($hImagebtn3, "msrating.dll", 10, True)
    _GUICtrlButton_SetImageList($btn3, $hImagebtn3)

    [/autoit] [autoit][/autoit] [autoit]

    Local $hChild4 = GUICreate("Child",90,90,30,160, $WS_POPUP, BitOR($WS_EX_MDICHILD, $WS_EX_ACCEPTFILES), $hGUI)
    ;single state image Bitmap with overlayed text
    $btn4 = GUICtrlCreateButton("Help", 0, 0, 90, 90)
    GUICtrlSetTip(-1, "Single bitmap imagelist with overlayed text")
    GUICtrlSetFont(-1, 14, 800, -1, "Comic Sans MS")
    $hImagebtn4 = _GUIImageList_Create(80, 80, 5, 3)
    _GUIImageList_AddBitmap($hImagebtn4, $sBMPImage)
    _GUICtrlButton_SetImageList($btn4, $hImagebtn4, 4)
    WinSetTrans($hChild1,"",135)
    WinSetTrans($hChild2,"",135)
    WinSetTrans($hChild3,"",135)
    WinSetTrans($hChild4,"",135)
    GUISetState(@SW_SHOW,$hGUI)
    GUISetState(@SW_SHOW,$hChild1)
    GUISetState(@SW_SHOW,$hChild2)
    GUISetState(@SW_SHOW,$hChild3)
    GUISetState(@SW_SHOW,$hChild4)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $btn1
    Case $btn2
    GUICtrlSetState($btn1, $GUI_DISABLE)
    Case $btn3
    GUICtrlSetState($btn1, $GUI_ENABLE)
    Case $btn4
    EndSwitch
    WEnd
    EndFunc ;==>_Main

    [/autoit] [autoit][/autoit] [autoit][/autoit]

    oder so:

    mit 1 Hilfsgui
    [autoit]

    ; *** Start added by AutoIt3Wrapper ***
    #include <WindowsConstants.au3>
    ; *** End added by AutoIt3Wrapper ***
    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_Add_Constants=n
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    ;#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
    #include <GUIConstantsEx.au3>
    #include <GuiButton.au3>
    #include <GuiImageList.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt("MustDeclareVars", 1)

    [/autoit] [autoit][/autoit] [autoit]

    _Main()

    [/autoit] [autoit][/autoit] [autoit]

    Func _Main()
    Local $sBMPNormal = @ScriptDIR & "\Icons\dsFirst_NORMAL.BMP"
    Local $sBMPHot = @ScriptDir & "\Icons\dsFirst_mouseover.bmp"
    Local $sBMPPress = @ScriptDir & "\Icons\dsFirst_mousedown.bmp"
    Local $sBMPImage = @WindowsDir & "\pchealth\helpctr\System\blurbs\watermark_300x.bmp"
    Local $btn1, $btn2, $btn3, $btn4, $msg
    Local $hImagebtn1, $hImagebtn2, $hImagebtn3 ,$hImagebtn4

    [/autoit] [autoit][/autoit] [autoit]

    ;Caveat: Minimum Operating Systems: Windows XP.

    [/autoit] [autoit][/autoit] [autoit]

    ;Image list with multiple images will only show the images
    ;other than the 1st image when Themes are used.

    [/autoit] [autoit][/autoit] [autoit]

    Local $hGUI = GUICreate("Button Imagelists - Minimum OS: Windows XP",400,300)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreatePic(@WindowsDir & "\Web\Wallpaper\Windows XP.jpg", 0, 0, 400, 300)
    GUICtrlSetState(-1, $GUI_DISABLE)
    Local $hChild = GUICreate("Child",400,300,0,0, $WS_POPUP, BitOR($WS_EX_MDICHILD, $WS_EX_ACCEPTFILES), $hGUI)
    ;multi state image Bitmap
    $btn1 = GUICtrlCreateButton("This Way", 30, 30, 90, 32)
    GUICtrlSetTip(-1, "Multi state bitmap imagelist")
    $hImagebtn1 = _GUIImageList_Create(24, 24, 3, 3)
    _GUIImageList_AddBitmap($hImagebtn1, $sBMPNormal);1 - Normal
    _GUIImageList_AddBitmap($hImagebtn1, $sBMPHot) ;2 - Hot
    _GUIImageList_AddBitmap($hImagebtn1, $sBMPPress) ;3 - Pressed
    _GUIImageList_AddBitmap($hImagebtn1, $sBMPPress);4 - Disabled
    _GUIImageList_AddBitmap($hImagebtn1, $sBMPNormal);5 - Defaulted
    _GUIImageList_AddBitmap($hImagebtn1, $sBMPNormal);6 - Stylus Hot (tablet computers only)
    _GUICtrlButton_SetImageList($btn1, $hImagebtn1)
    ;#cs
    ;single state image Bitmap
    $btn2 = GUICtrlCreateButton("This Way", 30, 70, 90, 32)
    GUICtrlSetTip(-1, "Single bitmap imagelist")
    $hImagebtn2 = _GUIImageList_Create(24, 24, 5, 3)
    _GUIImageList_AddBitmap($hImagebtn2, $sBMPNormal);1 - Normal
    _GUICtrlButton_SetImageList($btn2, $hImagebtn2)
    ;#ce
    ;single state image Icon
    $btn3 = GUICtrlCreateButton("Unlock", 30, 110, 90, 40)
    GUICtrlSetTip(-1, "Single icon imagelist")
    $hImagebtn3 = _GUIImageList_Create(32, 32, 5, 3)
    _GUIImageList_AddIcon($hImagebtn3, "msrating.dll", 10, True)
    _GUICtrlButton_SetImageList($btn3, $hImagebtn3)

    [/autoit] [autoit][/autoit] [autoit]

    ;single state image Bitmap with overlayed text
    $btn4 = GUICtrlCreateButton("Help", 30, 160, 90, 90)
    GUICtrlSetTip(-1, "Single bitmap imagelist with overlayed text")
    GUICtrlSetFont(-1, 14, 800, -1, "Comic Sans MS")
    $hImagebtn4 = _GUIImageList_Create(80, 80, 5, 3)
    _GUIImageList_AddBitmap($hImagebtn4, $sBMPImage)
    _GUICtrlButton_SetImageList($btn4, $hImagebtn4, 4)
    WinSetTrans($hChild,"",135)
    GUISetState(@SW_SHOW,$hGUI)
    GUISetState(@SW_SHOW,$hChild)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $btn1
    Case $btn2
    GUICtrlSetState($btn1, $GUI_DISABLE)
    Case $btn3
    GUICtrlSetState($btn1, $GUI_ENABLE)
    Case $btn4
    EndSwitch
    WEnd
    EndFunc ;==>_Main

    [/autoit] [autoit][/autoit] [autoit][/autoit]

    wenn du die 3 Beispiele nacheinander startest siehst du dass jedesmal ein Kompromiss eingegangen werden musste, du könntest dich höchstens einmal bei UEZ, Grossvater, Marsi & Co. umschauen ob es mit GDI+ bessere Möglichkeiten gibt,

    mfg autoBert

  • Ich benutze immer Labels statt Buttons, sie kann man auch mit clickdown-images und onevent-funktionen ausstatten, und es gibt absolut keine Ränder...
    ich kann ja mal eine kleine Beispiel-GUI posten wenn Interesse vorhanden ist...

    viele Grüße,
    r4lf