Hey Leute
ich hatte grade ziemlich langeweile und weil ich es nervig finde immer komplizierte pixelwerte für den abstand zum Rand, für die Breite und für die Höhe zu bemessen hab ich mir gedacht ich schreib mal ein winziges UDFchen um mir das einfacher zu machen:D
Spoiler anzeigen
#include <GuiConstantsEx.au3>
Global $realleft,$realtop,$realwidth,$realheight
#region Beispiel Anfang
GUICreate("ButtonCreate Test", 190, 190)
_buttonsetup(10, 10, 50, 50)
$button1 = _buttoncreate("1", 1, 1, 1, 1)
_buttoncreate("2", 2, 1, 1, 1)
_buttoncreate("3", 3, 1, 1, 1)
_buttoncreate("4", 1, 2, 2, 1)
_buttoncreate("5", 3, 2, 1, 2)
_buttoncreate("6", 1, 3, 2, 1)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $button1
MsgBox(0, "", "hallo")
EndSwitch
WEnd
#endregion Beispiel Ende
; #INDEX# =======================================================================================================================
; Title .........: StandartButton
; Language ......: English
; Description ...: Function: create buttons easily.
; Author(s) .....: DFPWare
; ===============================================================================================================================
; #CURRENT# =====================================================================================================================
;_buttoncreate
;_buttonsetup
; ===============================================================================================================================
; #FUNCTION# ====================================================================================================================
; Name...........: _buttonsetup
; Description ...: sets the realwidth, -height, -left, -top for _buttoncreate
; Syntax.........: _buttonsetup($iVerticalSpace, $iHorizontalSpace, $iCellWidth, $iCellHeight)
; Parameters ....: $iHorizontalSpace - left distance to border
; $iVerticalSpace - top distance to border
; $iCellWidth - width of the button
; $iCellHeight - height of the button
; Return value(s): -
; Author ........: DFPWare
; Example .......: No
; ===============================================================================================================================
Func _buttonsetup($iHorizontalSpace, $iVerticalSpace, $iCellWidth, $iCellHeight)
$realleft = $iHorizontalSpace
$realtop = $iVerticalSpace
$realwidth = $iCellWidth
$realheight = $iCellHeight
EndFunc ;==>_buttonsetup
; #FUNCTION# ====================================================================================================================
; Name...........: _buttoncreate
; Description ...: creates a button easily
; Syntax.........: _buttoncreate($Text,$left,$top,$width,$height)
; Parameters ....: $Text - Text on the button
; $left - left distance to border
; $top - top distance to border
; $width - width of the button
; $height - height of the button
; Return value(s): Control ID
; Author ........: DFPWare
; Example .......: No
; ===============================================================================================================================
Func _buttoncreate($Text, $left, $top, $width, $height)
Local $left1, $top1, $width1, $height1
$retvar = GUICtrlCreateButton($Text, $realleft + (($realleft + $realwidth) * ($left - 1)), $realtop + (($realtop + $realheight) * ($top - 1)), $realwidth + (($realleft + $realwidth) * ($width - 1)), $realheight + (($realtop + $realheight) * ($height - 1)))
Return $retvar
EndFunc ;==>_buttoncreate
PS: mit Beispiel;)