Hallo, AutoItler !
Habe nur ein kleines Problem.
Wie bekomme ich einen Text auf meine Buttons ???
Habe schon so einiges ausprobiert und hatte kein Erfolg.
Möchte keine normalen Buttons aller GUICtrlCreateButton...
siehe mein Script bisher (alles außer die coole routine von SEuBo!)
Spoiler anzeigen
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
Global Const $Font = "Arial Black", $FontSize = 10, $FontColor = 0x000000, $BgColorTitle = 0xFFFFFF, $BgColor = 0x777799, $TitleHeight = 20, $DefaultCtrlHeight = 16
[/autoit] [autoit][/autoit] [autoit]$Width = 400
$Height = 100
$Title = "ButtonControl"
$x_Button1 = 8
$y_Button1 = 30
$hGUI = GUICreate($Title, $Width, $Height, -1, -1, $WS_POPUP)
GUISetBkColor($BgColor)
$knopt1 = GUICtrLCreatePng($hGUI,@ScriptDir & "\Button.png", $x_Button1, $y_Button1)
$knopt2 = GUICtrLCreatePng($hGUI,@ScriptDir & "\Button.png", $x_Button1, $y_Button1+17)
$knopt3 = GUICtrLCreatePng($hGUI,@ScriptDir & "\Button.png", $x_Button1, $y_Button1+34)
$knopt4 = GUICtrLCreatePng($hGUI,@ScriptDir & "\Button.png", $x_Button1, $y_Button1+51)
$Close = GUICtrlCreatePic("close.bmp", $Width - 16, 7, 9, 9)
$Minimize = GUICtrlCreatePic("minimize.bmp", $Width - 31, 7, 9, 9)
GUISetFont($FontSize, 400, 0, $Font)
$TitleBar = GUICtrlCreateLabel($Title, 6, 4, $Width - 42, 17, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetColor(-1, $FontColor)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlCreateGraphic(0, 0, $Width, $TitleHeight)
GUICtrlSetBkColor(-1, $BgColorTitle)
GuiRoundCorners($hGUI, 0, 0, 2, 2)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $knopt1
MsgBox(0,"","Button1 geklickt!",1)
Case $knopt2
MsgBox(0,"","Button2 geklickt!",1)
Case $knopt3
MsgBox(0,"","Button3 geklickt!",1)
Case $knopt4
MsgBox(0,"","Button4 geklickt!",1)
Case $Minimize
GUISetState(@SW_MINIMIZE)
Case $Close
ExitLoop
; Case $GUI_EVENT_CLOSE
; ExitLoop
EndSwitch
WEnd
Exit
Func GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3)
$pos = WinGetPos($h_win)
$ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3)
If $ret[0] Then
$ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1)
If $ret2[0] Then
Return 1
Else
Return 0
EndIf
Else
Return 0
EndIf
EndFunc ;==>GuiRoundCorners
Func GUICtrlCreatePng($hWnd, $sPath, $iX, $iY) ; SEuBo
_GDIPlus_Startup()
Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend, $hGUI
Local $hImage = _GDIPlus_ImageLoadFromFile($sPath), $iWidth = _GDIPlus_ImageGetWidth($hImage), $iHeight = _GDIPlus_ImageGetHeight($hImage)
$hGUI = GUICreate("", $iWidth, $iHeight, $iX, $iY, 0x80000000, BitOR(0x40, 0x80000), $hWnd)
$cLabel = GUICtrlCreateLabel("", 0, 0, $iWidth, $iHeight)
GUICtrlSetBkColor(-1, -2)
GUISetState(@SW_SHOWNOACTIVATE, $hGUI)
$hScrDC = _WinAPI_GetDC(0)
$hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
$hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
$tSize = DllStructCreate("int X;int Y")
$pSize = DllStructGetPtr($tSize)
DllStructSetData($tSize, "X", $iWidth)
DllStructSetData($tSize, "Y", $iHeight)
$tSource = DllStructCreate("int X;int Y")
$pSource = DllStructGetPtr($tSource)
$tBlend = DllStructCreate("byte Op;byte Flags;byte Alpha;byte Format")
$pBlend = DllStructGetPtr($tBlend)
DllStructSetData($tBlend, "Alpha", 255)
DllStructSetData($tBlend, "Format", 1)
_WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
_WinAPI_ReleaseDC(0, $hScrDC)
_WinAPI_SelectObject($hMemDC, $hOld)
_WinAPI_DeleteObject($hBitmap)
_WinAPI_DeleteDC($hMemDC)
GUISwitch($hWnd)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()
Return SetError(0,$hGUI,$cLabel)
EndFunc ;==>GUICtrlCreatePng
Für eine Hilfe würde ich mich sehr freunen!
Hier noch mal mein Script mit den Grafik-Dateien: autoit.de/wcf/attachment/12224/
mfg
tv_freeze