Hiho, ich weiß nicht ob es das bereits gibt, oder ob jemand es gebrauchen kann, aber mir persönlich ist es zu doof entweder viele einzelne Labels zu erstellen oder jedes mal ein Editfeld zu nutzen, also hab ich hier mal 2 kleine Funktionen zum erstellen von Mehrzeiligen Labels geschrieben. Wie gesagt, vielleicht kanns jemand gebrauchen
Spoiler anzeigen
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Dim $Lines[3]
$Lines[0] = "Hi"
$Lines[1] = "My Name is Hans"
$Lines[2] = "The L stands for Danger!"
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 625, 445, 193, 125)
$Color = GUICtrlCreateButton("Color", 8, 376, 75, 25, 0)
$ML_Control = _GUICtrlCreate_MultiLineLabel($Lines, 8,
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Color
_GUICtrl_MultiLineLabel_SetColor($ML_Control, 0xFF89FF, 0x000000)
EndSwitch
WEnd
; #FUNCTION# ====================================================================================================================
; Name...........: _GUICtrlCreate_MultiLineLabel
; Description ...: Creates a MultiLineLabel in a GUI
; Parameters.....: $Lines = Array of Lines to Create
; ...............: $x & y = X and Y Position of the MultiLineLabel to Create
; ...............: $dist = The distance between the Labels (15-20 is recommend for normal textformat)
; ...............: $Font = The Fontstyle to use in the Control (As String)
; ...............: $Front & $BackColor = The Front and Background Color beeing used in the Control | Set this to 'trans' for an transparent color
; Author ........: Felix Lehmann alias eF_Hacks (http://www.autoit.de)
; Modified.......: If you modify this Script, please enter your name here
; Remarks .......: Change the states of the single controls by using ControlSet..
; Related .......: -
; Link ..........; http://www.autoit.de
; ===============================================================================================================================
Func _GUICtrlCreate_MultiLineLabel($Lines, $x, $y, $dist = 15, $Font = 'MS Sans Serif', $FrontColor = 0x000000, $BackColor = 0xF0F0F0)
If Not IsArray($Lines) Then SetError(-1, 0, -1)
If Not IsString($Font) Then SetError(-2, 0, -2)
Local $Labels[1]
$y =- $dist
For $x = 0 To UBound($Lines) - 1
$y += $dist
$Labels[$x] = GUICtrlCreateLabel($Lines[$x], $x, $y)
Switch $FrontColor
Case 'trans'
GUICtrlSetColor($Labels[$x], $GUI_BKCOLOR_TRANSPARENT)
Case Else
GUICtrlSetColor($Labels[$x], $FrontColor)
EndSwitch
Switch $BackColor
Case 'trans'
GUICtrlSetBkColor($Labels[$x], $GUI_BKCOLOR_TRANSPARENT)
Case Else
GUICtrlSetBkColor($Labels[$x], $BackColor)
EndSwitch
$iUbound = UBound($Labels)
ReDim $Labels[$iUbound + 1]
Next
Return $Labels
EndFunc ;==>_GUICtrlCreate_MultiLineLabel
; #FUNCTION# ====================================================================================================================
; Name...........: _GUICtrl_MultiLineLabel_SetColor
; Description ...: Sets the Color's of a previous created MultiLineLabel
; Parameters.....: $Control = The Handle of the Control returned from _GUICtrlCreate_MultiLineLabel
; ...............: $Front & $BackColor = The Front and Background Color beeing used in the Control
; Author ........: Felix Lehmann alias eF_Hacks (http://www.autoit.de)
; Modified.......: If you modify this Script, please enter your name here
; Remarks .......: Change the states of the single controls by using ControlSet..
; Related .......: -
; Link ..........; http://www.autoit.de
; ===============================================================================================================================
Func _GUICtrl_MultiLineLabel_SetColor($Control, $Foreground, $Background)
If Not IsArray($Control) Then SetError(-1, 1, -1)
Local $iUbound = UBound($Control)
For $x = 0 To $iUbound -1
GUICtrlSetColor($Control[$x], $Foreground)
GUICtrlSetBkColor($Control[$x], $Background)
Next
Return 1
EndFunc ;==>_GUICtrl_MultiLineLabel_SetColor