Style UDF
[Blockierte Grafik: http://www8.pic-upload.de/07.08.11/vaetaxgq48ku.png]
Beschreibung: Mit der Style UDF kann man bisher eine Form, Button, TextField, MessagesBox, InputBox, Label und ProgressBar erstellen
Bei diesen Controls kann man die Rahmenfarbe(außer bei Labels) ,die Hintergrundfarbe und andere Eigenschaften ändern
Was noch kommt
Spoiler anzeigen
Die UDF ist wie man sieht noch nicht fertig
1. Ändern der Schriftfarbe
2. Ändern der Schriftart
3. noch mehr Controls
4. Bugs behebung
Beispiel
Spoiler anzeigen
#include <Style UDF.au3>
Dim $Farbe[5]
$Farbe[0] = 0xff0000
$Farbe[1] = 0x00ff00
$Farbe[2] = 0x0000ff
$Farbe[3] = 0xffff00
$Farbe[4] = 0x00ffff
$Form1 = _NewForm("Form1","Form1", Default, Default, 202, 225)
$Button1 = _NewButton("Button1","Beenden", 120, 160)
$Button2 = _NewButton("Button2","Diashow", 8, 160)
$Button3 = _NewButton("Button3","MessagesBox", 8,
$Button4 = _NewButton("Button4","Beispiel", 8, 40)
$Button5 = _NewButton("Button5","InputBox", 120,
$NewTextField1 = _NewTextField("NewTextField1","", 8, 72)
$Label1 = _NewLabel("Label1","Beispiel", 8, 104, 36, 17)
$ProgressBar1 = _NewProgressBar("ProgressBar1",8, 128,Default,Default,Default,Default,Default,50)
_SetOption($Form1,"EffectOnLeft")
_SetState($Form1,"Show")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case _GetCloseButtonHandle($Form1)
Exit
Case _GetMinimizeButtonHandle($Form1)
_SetState($Form1,"Minimize")
Case _GetHandle($Button1)
Exit
Case _GetHandle($Button3)
_NewMessagesBox("Beispiel","Beispiel","Schließen")
Case _GetHandle($Button5)
_NewInputBox("Beispiel","Beispiel","Schließen")
Case _GetHandle($Button2)
For $i = 0 To 4
_SetAllColors($Farbe[$i])
_SetAllBgColors($Farbe[Random(0,4)])
Sleep(500)
Next
_SetAllColors(0xff0000)
_SetAllBgColors(0x00ff00)
EndSwitch
_SetForm($Form1)
WEnd
Style UDF
Spoiler anzeigen
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <Array.au3>
#include <EditConstants.au3>
Dim $Graphic[100][23]
Global $Counter = 7
Func _NewForm($Id, $Text, $Left, $Top, $Width, $Height, $Color = 0x666666, $BgColor = 0xEDEDED, $FormBgColor = 0xFFFFFF)
If $Id = "MessagesBox" Then
$SaveCounter = $Counter
$Counter = 0
ElseIf $Id = "InputBox" Then
$SaveCounter = $Counter
$Counter = 3
EndIf
If $Left = Default Then $Left = @DesktopWidth / 2 - $Width / 2
If $Top = Default Then $Top = @DesktopHeight / 2 - $Height / 2
If $Color = Default Then $Color = 0x666666
If $FormBgColor = Default Then $FormBgColor = 0xFFFFFF
If $BgColor = Default Then $BgColor = 0xEDEDED
$Graphic[$Counter][0] = GUICreate($Text, $Width, $Height, $Left, $Top, BitOR($WS_MINIMIZEBOX, $WS_SYSMENU, $WS_DLGFRAME, $WS_POPUP, $WS_GROUP, $WS_CLIPSIBLINGS))
$Graphic[$Counter][2] = $Id
$Graphic[$Counter][3] = $Left
$Graphic[$Counter][4] = $Top
$Graphic[$Counter][5] = $Width
$Graphic[$Counter][6] = $Height
$Graphic[$Counter][7] = $Color
$Graphic[$Counter][8] = $BgColor
$Graphic[$Counter][11] = $Text
$Graphic[$Counter][13] = "Form"
$Graphic[$Counter][22] = $FormBgColor
GUISetBkColor($FormBgColor)
$Graphic[$Counter][14] = GUICtrlCreateGraphic($Graphic[$Counter][5] - 25, 0, 25, 25)
GUICtrlSetBkColor(-1, $Color)
$Graphic[$Counter][15] = GUICtrlCreateLabel(" X", $Graphic[$Counter][5] - 24, 1, 23, 23)
GUICtrlSetBkColor(-1, $BgColor)
GUICtrlSetFont(-1, 16, 400, 1, "MS Sans Serif")
$Graphic[$Counter][16] = GUICtrlCreateGraphic($Graphic[$Counter][5] - 52, 0, 25, 25)
GUICtrlSetBkColor(-1, $Color)
$Graphic[$Counter][17] = GUICtrlCreateLabel(" -", $Graphic[$Counter][5] - 51, 1, 23, 23)
GUICtrlSetFont(-1, 18, 800, 1, "MS Sans Serif")
GUICtrlSetBkColor(-1, $BgColor)
$Graphic[$Counter][18] = GUICtrlCreateGraphic(0, 0, $Width - 54, 25)
GUICtrlSetBkColor(-1, $Color)
$Graphic[$Counter][19] = GUICtrlCreateLabel($Text, 1, 1, $Width - 56, 23, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $BgColor)
$Counter = $Counter + 1
If $Id = "MessagesBox" Then $Counter = $SaveCounter
If $Id = "InputBox" Then $Counter = $SaveCounter
Return $Id
EndFunc ;==>_NewForm
Func _NewLabel($Id, $Text, $Left, $Top, $Width = 75, $Height = 25, $BgColor = 0xFFFFFF)
If $Id = "MessagesBoxLabel" Then
$SaveCounter = $Counter
$Counter = 1
ElseIf $Id = "InputBoxLabel" Then
$SaveCounter = $Counter
$Counter = 4
EndIf
$Top = $Top + 26
If $Text = Default Then $Text = ""
If $Width = Default Then $Width = 75
If $Height = Default Then $Height = 25
If $BgColor = Default Then $BgColor = 0xFFFFFF
$Graphic[$Counter][0] = GUICtrlCreateLabel($Text, $Left, $Top, $Width, $Height, BitOR($SS_CENTER, $SS_CENTERIMAGE))
$Graphic[$Counter][2] = $Id
$Graphic[$Counter][3] = $Left
$Graphic[$Counter][4] = $Top
$Graphic[$Counter][5] = $Width
$Graphic[$Counter][6] = $Height
$Graphic[$Counter][8] = $BgColor
$Graphic[$Counter][11] = $Text
$Graphic[$Counter][13] = "Label"
GUICtrlSetBkColor($Graphic[$Counter][0], $BgColor)
$Counter = $Counter + 1
If $Id = "MessagesBoxLabel" Then $Counter = $SaveCounter
If $Id = "InputBoxLabel" Then $Counter = $SaveCounter
Return $Id
EndFunc ;==>_NewLabel
Func _NewTextField($Id, $Text, $Left, $Top, $Width = 120, $Height = 20, $Color = 0x666666, $BgColor = 0xFFFFFF)
If $Id = "InputBoxTextField" Then
$SaveCounter = $Counter
$Counter = 6
EndIf
$Top = $Top + 26
If $Text = Default Then $Text = ""
If $Width = Default Then $Width = 120
If $Height = Default Then $Height = 20
If $Color = Default Then $Color = 0x666666
If $BgColor = Default Then $BgColor = 0xFFFFFF
$Graphic[$Counter][2] = $Id
$Graphic[$Counter][3] = $Left
$Graphic[$Counter][4] = $Top
$Graphic[$Counter][5] = $Width
$Graphic[$Counter][6] = $Height
$Graphic[$Counter][7] = $Color
$Graphic[$Counter][8] = $BgColor
$Graphic[$Counter][11] = $Text
$Graphic[$Counter][12] = GUICtrlCreateInput($Text, $Left + 1, $Top + 1, $Width - 2, $Height - 2, -1, $WS_EX_TOOLWINDOW)
$Graphic[$Counter][13] = "TextField"
$Graphic[$Counter][0] = GUICtrlCreateGraphic($Left, $Top, $Width, $Height)
GUICtrlSetBkColor($Graphic[$Counter][0], $Color)
GUICtrlSetBkColor($Graphic[$Counter][12], $BgColor)
$Counter = $Counter + 1
If $Id = "InputBoxTextField" Then $Counter = $SaveCounter
Return $Id
EndFunc ;==>_NewTextField
Func _NewButton($Id, $Text, $Left, $Top, $Width = 75, $Height = 25, $Color = 0x666666, $BgColor = 0xEDEDED)
If $Id = "MessagesBoxButton" Then
$SaveCounter = $Counter
$Counter = 2
ElseIf $Id = "InputBoxButton" Then
$SaveCounter = $Counter
$Counter = 5
EndIf
$Top = $Top + 26
If $Text = Default Then $Text = ""
If $Width = Default Then $Width = 75
If $Height = Default Then $Height = 25
If $Color = Default Then $Color = 0x666666
If $BgColor = Default Then $BgColor = 0xEDEDED
$Graphic[$Counter][0] = GUICtrlCreateGraphic($Left, $Top, $Width, $Height)
$Graphic[$Counter][2] = $Id
$Graphic[$Counter][3] = $Left
$Graphic[$Counter][4] = $Top
$Graphic[$Counter][5] = $Width
$Graphic[$Counter][6] = $Height
$Graphic[$Counter][7] = $Color
$Graphic[$Counter][8] = $BgColor
$Graphic[$Counter][11] = $Text
$Graphic[$Counter][12] = GUICtrlCreateLabel($Graphic[$Counter][11], $Left + 1, $Top + 1, $Width - 2, $Height - 2, BitOR($SS_CENTER, $SS_CENTERIMAGE))
$Graphic[$Counter][13] = "Button"
GUICtrlSetColor($Graphic[$Counter][0], $Color)
GUICtrlSetBkColor($Graphic[$Counter][0], $BgColor)
GUICtrlSetBkColor($Graphic[$Counter][12], $BgColor)
$Counter = $Counter + 1
If $Id = "MessagesBoxButton" Then $Counter = $SaveCounter
If $Id = "InputBoxButton" Then $Counter = $SaveCounter
Return $Id
EndFunc ;==>_NewButton
Func _NewProgressBar($Id, $Left, $Top, $Width = 150, $Height = 20, $Color = 0x666666, $BgColor = 0xFFFFFF, $ContentColor = 0x3366CC, $Position = 0)
$Top = $Top + 26
If $Width = Default Then $Width = 150
If $Height = Default Then $Height = 20
If $Color = Default Then $Color = 0x666666
If $BgColor = Default Then $BgColor = 0xFFFFFF
If $ContentColor = Default Then $ContentColor = 0x3366CC
If $Position = Default Then $Position = 0
$Width = $Width - 2
$StringPosition = $Width / 100 * $Position
$Width = $Width + 2
$Graphic[$Counter][0] = GUICtrlCreateGraphic($Left, $Top, $Width, $Height)
$Graphic[$Counter][1] = GUICtrlCreateGraphic($Left + 1, $Top + 1, $StringPosition, $Height - 2)
$Graphic[$Counter][2] = $Id
$Graphic[$Counter][3] = $Left
$Graphic[$Counter][4] = $Top
$Graphic[$Counter][5] = $Width
$Graphic[$Counter][6] = $Height
$Graphic[$Counter][7] = $Color
$Graphic[$Counter][8] = $BgColor
$Graphic[$Counter][9] = $ContentColor
$Graphic[$Counter][10] = $Position
$Graphic[$Counter][13] = "ProgressBar"
GUICtrlSetColor($Graphic[$Counter][0], $Color)
GUICtrlSetBkColor($Graphic[$Counter][0], $BgColor)
GUICtrlSetBkColor($Graphic[$Counter][1], $ContentColor)
$Counter = $Counter + 1
Return $Id
EndFunc ;==>_NewProgressBar
Func _SetPosition($Id, $Position)
For $i = 0 To UBound($Graphic) - 1
If $Id = $Graphic[$i][2] Then
$Graphic[$i][10] = $Position
$Graphic[$i][5] = $Graphic[$i][5] - 2
$StringPosition = $Graphic[$i][5] / 100 * $Position
$Graphic[$i][5] = $Graphic[$i][5] + 2
GUICtrlSetPos($Graphic[$i][1], $Graphic[$i][3] + 1, $Graphic[$i][4] + 1, $StringPosition, $Graphic[$i][6] - 2)
EndIf
Next
$Position = 0
EndFunc ;==>_SetPosition
Func _SetFormBgColor($Id, $FormBgColor)
For $i = 0 To UBound($Graphic) - 1
If $Id = $Graphic[$i][2] Then
If $Graphic[$i][13] = "Form" Then GUISetBkColor($FormBgColor, $Graphic[$i][0])
$Graphic[$i][22] = $FormBgColor
EndIf
Next
$Position = 0
EndFunc ;==>_SetFormBgColor
Func _SetBgColor($Id, $BgColor)
For $i = 0 To UBound($Graphic) - 1
If $Id = $Graphic[$i][2] Then
If $Graphic[$i][13] <> "Form" Then
$Graphic[$i][8] = $BgColor
GUICtrlSetBkColor($Graphic[$i][0], $Graphic[$i][8])
If $Graphic[$i][13] = "Button" Then GUICtrlSetBkColor($Graphic[$i][12], $BgColor)
If $Graphic[$i][13] = "TextField" Then GUICtrlSetBkColor($Graphic[$i][12], $BgColor)
Else
$Graphic[$i][8] = $BgColor
GUICtrlSetBkColor($Graphic[$i][15], $Graphic[$i][8])
GUICtrlSetBkColor($Graphic[$i][17], $Graphic[$i][8])
GUICtrlSetBkColor($Graphic[$i][19], $Graphic[$i][8])
EndIf
EndIf
Next
EndFunc ;==>_SetBgColor
Func _SetText($Id, $Text)
For $i = 0 To UBound($Graphic) - 1
If $Id = $Graphic[$i][2] Then
If $Graphic[$i][13] = "Label" Then
GUICtrlSetData($Graphic[$i][0], $Text)
ElseIf $Graphic[$i][13] = "Form" Then
WinSetTitle("", "", $Text)
$Graphic[$i][11] = $Text
GUICtrlSetData($Graphic[$i][19], $Text)
Else
GUICtrlSetData($Graphic[$i][12], $Text)
EndIf
$Graphic[$i][11] = $Text
EndIf
Next
EndFunc ;==>_SetText
Func _SetColor($Id, $Color)
For $i = 0 To UBound($Graphic) - 1
If $Id = $Graphic[$i][2] Then
If $Graphic[$i][13] <> "Label" Then
If $Graphic[$i][13] <> "Form" Then
$Graphic[$i][7] = $Color
GUICtrlSetColor($Graphic[$i][0], $Graphic[$i][7])
Else
$Graphic[$i][7] = $Color
GUICtrlSetBkColor($Graphic[$i][14], $Graphic[$i][7])
GUICtrlSetBkColor($Graphic[$i][16], $Graphic[$i][7])
GUICtrlSetBkColor($Graphic[$i][18], $Graphic[$i][7])
EndIf
EndIf
EndIf
Next
EndFunc ;==>_SetColor
Func _SetContentColor($Id, $ContentColor)
For $i = 0 To UBound($Graphic) - 1
If $Id = $Graphic[$i][2] Then
$Graphic[$i][9] = $ContentColor
GUICtrlSetBkColor($Graphic[$i][1], $Graphic[$i][9])
EndIf
Next
EndFunc ;==>_SetContentColor
Func _SetBounds($Id, $Left = Default, $Top = Default, $Width = Default, $Height = Default)
$Top = $Top + 26
For $i = 0 To 99
If $Id = $Graphic[$i][2] Then
If $Graphic[$i][13] <> "Form" Then
If $Left = Default Then $Left = $Graphic[$i][3]
If $Top = Default Then $Top = $Graphic[$i][4]
If $Width = Default Then $Width = $Graphic[$i][5]
If $Height = Default Then $Height = $Graphic[$i][6]
$Graphic[$i][3] = $Left
$Graphic[$i][4] = $Top
$Graphic[$i][5] = $Width
$Graphic[$i][6] = $Height
GUICtrlSetPos($Graphic[$i][0], $Graphic[$i][3], $Graphic[$i][4], $Graphic[$i][5], $Graphic[$i][6])
GUICtrlSetPos($Graphic[$i][12], $Graphic[$i][3] + 1, $Graphic[$i][4] + 1, $Graphic[$i][5] - 2, $Graphic[$i][6] - 2)
_SetPosition($Id, $Graphic[$i][10])
EndIf
EndIf
Next
EndFunc ;==>_SetBounds
Func _GetContentColor($Id)
For $i = 0 To UBound($Graphic) - 1
If $Id = $Graphic[$i][2] Then
Return "0x" & Hex($Graphic[$i][9], 6)
EndIf
Next
EndFunc ;==>_GetContentColor
Func _GetColor($Id)
For $i = 0 To UBound($Graphic) - 1
If $Id = $Graphic[$i][2] Then
Return "0x" & Hex($Graphic[$i][7], 6)
EndIf
Next
EndFunc ;==>_GetColor
Func _GetFormBgColor($Id)
For $i = 0 To UBound($Graphic) - 1
If $Id = $Graphic[$i][2] Then
Return "0x" & Hex($Graphic[$i][22], 6)
EndIf
Next
EndFunc ;==>_GetFormBgColor
Func _GetBgColor($Id)
For $i = 0 To UBound($Graphic) - 1
If $Id = $Graphic[$i][2] Then
Return "0x" & Hex($Graphic[$i][8], 6)
EndIf
Next
EndFunc ;==>_GetBgColor
Func _GetPosition($Id)
For $i = 0 To UBound($Graphic) - 1
If $Id = $Graphic[$i][2] Then
Return $Graphic[$i][10]
EndIf
Next
EndFunc ;==>_GetPosition
Func _GetText($Id)
For $i = 0 To UBound($Graphic) - 1
If $Id = $Graphic[$i][2] Then
If $Graphic[$i][13] = "TextField" Then
$Read = GUICtrlRead($Graphic[$i][12])
$Graphic[$i][11] = $Read
EndIf
Return $Graphic[$i][11]
EndIf
Next
EndFunc ;==>_GetText
Func _GetBounds($Id)
For $i = 0 To UBound($Graphic) - 1
If $Id = $Graphic[$i][2] Then
Return "[" & $Graphic[$i][3] & "][" & $Graphic[$i][4] & "][" & $Graphic[$i][5] & "][" & $Graphic[$i][6] & "]"
EndIf
Next
EndFunc ;==>_GetBounds
Func _SetForm($Id)
For $i = 0 To UBound($Graphic) - 1
If $Id = $Graphic[$i][2] Then
Local $MousePosition = MouseGetPos()
Local $WindowPosition = WinGetPos($Graphic[$i][12])
If $MousePosition[0] >= $WindowPosition[0] And $MousePosition[0] <= $WindowPosition[0] + $Graphic[$i][5] Then
If $MousePosition[1] >= $WindowPosition[1] And $MousePosition[1] <= $WindowPosition[1] + 25 Then
If WinActive($Graphic[$i][11]) Then
If _IsPressed(1) = 1 Then
Do
Local $MousePosition1 = MouseGetPos()
Sleep(1)
Local $MousePosition2 = MouseGetPos()
If $MousePosition1[1] > $MousePosition2[1] Then
WinMove($Graphic[$i][11], "", $Graphic[$i][3], $Graphic[$i][4] + $MousePosition2[1] - $MousePosition1[1])
$Graphic[$i][4] = $Graphic[$i][4] + $MousePosition2[1] - $MousePosition1[1]
EndIf
If $MousePosition1[1] < $MousePosition2[1] Then
WinMove($Graphic[$i][11], "", $Graphic[$i][3], $Graphic[$i][4] + $MousePosition2[1] - $MousePosition1[1])
$Graphic[$i][4] = $Graphic[$i][4] + $MousePosition2[1] - $MousePosition1[1]
EndIf
If $MousePosition1[0] > $MousePosition2[0] Then
WinMove($Graphic[$i][11], "", $Graphic[$i][3] + $MousePosition2[0] - $MousePosition1[0], $Graphic[$i][4])
$Graphic[$i][3] = $Graphic[$i][3] + $MousePosition2[0] - $MousePosition1[0]
EndIf
If $MousePosition1[0] < $MousePosition2[0] Then
WinMove($Graphic[$i][11], "", $Graphic[$i][3] + $MousePosition2[0] - $MousePosition1[0], $Graphic[$i][4])
$Graphic[$i][3] = $Graphic[$i][3] + $MousePosition2[0] - $MousePosition1[0]
EndIf
Until _IsPressed(1) = 0
EndIf
EndIf
EndIf
EndIf
EndIf
Next
EndFunc ;==>_SetForm
Func _GetHandle($Id)
For $i = 0 To UBound($Graphic) - 1
If $Id = $Graphic[$i][2] Then
Return $Graphic[$i][0]
EndIf
Next
EndFunc ;==>_GetHandle
Func _GetCloseButtonHandle($Id)
For $i = 0 To UBound($Graphic) - 1
If $Id = $Graphic[$i][2] Then
Return $Graphic[$i][14]
EndIf
Next
EndFunc ;==>_GetCloseButtonHandle
Func _GetMinimizeButtonHandle($Id)
For $i = 0 To UBound($Graphic) - 1
If $Id = $Graphic[$i][2] Then
Return $Graphic[$i][16]
EndIf
Next
EndFunc ;==>_GetMinimizeButtonHandle
Func _GetGraphics()
_ArrayDisplay($Graphic, "Graphics")
EndFunc ;==>_GetGraphics
Func _NewMessagesBox($Title = "", $Content = "", $ButtonContent = "Cancel")
If $Title = Default Then $Title = ""
If $Content = Default Then $Content = ""
_NewForm("MessagesBox", $Title, Default, Default, 200, 150)
_NewButton("MessagesBoxButton", $ButtonContent, 50, 80, 100, 30)
_NewLabel("MessagesBoxLabel", $Content, 0, 0, 200, 80)
_SetState("MessagesBox", "Show")
$Exit = 0
Do
$Message = GUIGetMsg()
Switch $Message
Case _GetMinimizeButtonHandle("MessagesBox")
_SetState("MessagesBox", "Minimize")
Case _GetCloseButtonHandle("MessagesBox")
For $i2 = 0 To UBound($Graphic) - 1
If "MessagesBox" = $Graphic[$i2][2] Then
GUIDelete($Graphic[$i2][0])
$Exit = 1
EndIf
Next
Case _GetHandle("MessagesBoxButton")
For $i2 = 0 To UBound($Graphic) - 1
If "MessagesBox" = $Graphic[$i2][2] Then
GUIDelete($Graphic[$i2][0])
$Exit = 1
EndIf
Next
EndSwitch
_SetForm("MessagesBox")
Until $Exit = 1
EndFunc ;==>_NewMessagesBox
Func _NewInputBox($Title = "", $Content = "", $ButtonContent = "Cancel")
If $Title = Default Then $Title = ""
If $Content = Default Then $Content = ""
_NewForm("InputBox", $Title, Default, Default, 200, 150)
_NewButton("InputBoxButton", $ButtonContent, 50, 80, 100, 30)
_NewLabel("InputBoxLabel", $Content, 0, 0, 200, 40)
_NewTextField("InputBoxTextField", "", 20, 40, 160, 20)
_SetState("InputBox", "Show")
$Exit = 0
Do
$Message = GUIGetMsg()
Switch $Message
Case _GetMinimizeButtonHandle("InputBox")
_SetState("InputBox", "Minimize")
Case _GetCloseButtonHandle("InputBox")
For $i2 = 0 To UBound($Graphic) - 1
If "InputBox" = $Graphic[$i2][2] Then
GUIDelete($Graphic[$i2][0])
$Exit = 1
EndIf
Next
Case _GetHandle("InputBoxButton")
For $i2 = 0 To UBound($Graphic) - 1
If "InputBox" = $Graphic[$i2][2] Then
GUIDelete($Graphic[$i2][0])
$Exit = 1
EndIf
Next
EndSwitch
_SetForm("InputBox")
Until $Exit = 1
$Return = _GetText("InputBoxTextField")
Return $Return
EndFunc ;==>_NewInputBox
Func _SetAllColors($Color)
For $i = 0 To UBound($Graphic) - 1
If $Graphic[$i][13] <> "Label" Then
If $Graphic[$i][13] <> "Form" Then
$Graphic[$i][7] = $Color
GUICtrlSetColor($Graphic[$i][0], $Graphic[$i][7])
Else
$Graphic[$i][7] = $Color
GUICtrlSetBkColor($Graphic[$i][14], $Graphic[$i][7])
GUICtrlSetBkColor($Graphic[$i][16], $Graphic[$i][7])
GUICtrlSetBkColor($Graphic[$i][18], $Graphic[$i][7])
EndIf
EndIf
Next
EndFunc ;==>_SetAllColors
Func _SetAllBgColors($BgColor)
For $i = 0 To UBound($Graphic) - 1
If $Graphic[$i][13] <> "Form" Then
$Graphic[$i][8] = $BgColor
GUICtrlSetBkColor($Graphic[$i][0], $Graphic[$i][8])
If $Graphic[$i][13] = "Button" Then GUICtrlSetBkColor($Graphic[$i][12], $BgColor)
If $Graphic[$i][13] = "TextField" Then GUICtrlSetBkColor($Graphic[$i][12], $BgColor)
Else
$Graphic[$i][8] = $BgColor
GUICtrlSetBkColor($Graphic[$i][15], $Graphic[$i][8])
GUICtrlSetBkColor($Graphic[$i][17], $Graphic[$i][8])
GUICtrlSetBkColor($Graphic[$i][19], $Graphic[$i][8])
EndIf
Next
EndFunc ;==>_SetAllBgColors
Func _SetAllPositions($Position)
For $i = 0 To UBound($Graphic) - 1
$Graphic[$i][10] = $Position
$Graphic[$i][5] = $Graphic[$i][5] - 2
$StringPosition = $Graphic[$i][5] / 100 * $Position
$Graphic[$i][5] = $Graphic[$i][5] + 2
GUICtrlSetPos($Graphic[$i][1], $Graphic[$i][3] + 1, $Graphic[$i][4] + 1, $StringPosition, $Graphic[$i][6] - 2)
Next
$Position = 0
EndFunc ;==>_SetAllPositions
Func _SetAllContentColors($ContentColor)
For $i = 0 To UBound($Graphic) - 1
$Graphic[$i][9] = $ContentColor
GUICtrlSetBkColor($Graphic[$i][1], $Graphic[$i][9])
Next
EndFunc ;==>_SetAllContentColors
Func _SetState($Id, $State)
For $i = 0 To UBound($Graphic) - 1
If $Id = $Graphic[$i][2] Then
If $Graphic[$i][13] = "Form" Then
If $State = "Show" Then
If $Graphic[$i][20] = "OnLeft" Then
WinMove($Graphic[$i][11], "", 0 - $Graphic[$i][5], $Graphic[$i][4])
GUISetState(@SW_SHOW)
$LeftPosition = 0 - $Graphic[$i][5]
If $Graphic[$i][21] <> "" Then
$Speed = $Graphic[$i][21]
Else
$Speed = 5
EndIf
Do
WinMove($Graphic[$i][11], "", $LeftPosition, $Graphic[$i][4])
Sleep($Speed)
$LeftPosition = $LeftPosition + $Graphic[$i][3] / 20
Until $LeftPosition >= $Graphic[$i][3]
$Graphic[$i][3] = $LeftPosition
ElseIf $Graphic[$i][20] = "OnRight" Then
WinMove($Graphic[$i][11], "", @DesktopWidth, $Graphic[$i][4])
GUISetState(@SW_SHOW)
$RightPosition = @DesktopWidth
If $Graphic[$i][21] <> "" Then
$Speed = $Graphic[$i][21]
Else
$Speed = 5
EndIf
Do
WinMove($Graphic[$i][11], "", $RightPosition, $Graphic[$i][4])
Sleep($Speed)
$RightPosition = $RightPosition - $Graphic[$i][3] / 20
Until $RightPosition <= $Graphic[$i][3]
$Graphic[$i][3] = $RightPosition
ElseIf $Graphic[$i][20] = "OnAbove" Then
WinMove($Graphic[$i][11], "", $Graphic[$i][3], 0 - $Graphic[$i][6])
GUISetState(@SW_SHOW)
$AbovePosition = 0 - $Graphic[$i][6]
If $Graphic[$i][21] <> "" Then
$Speed = $Graphic[$i][21]
Else
$Speed = 5
EndIf
Do
WinMove($Graphic[$i][11], "", $Graphic[$i][3], $AbovePosition)
Sleep($Speed)
$AbovePosition = $AbovePosition + $Graphic[$i][4] / 20
Until $AbovePosition >= $Graphic[$i][4]
$Graphic[$i][4] = $AbovePosition
ElseIf $Graphic[$i][20] = "OnBelow" Then
WinMove($Graphic[$i][11], "", $Graphic[$i][3], @DesktopHeight)
GUISetState(@SW_SHOW)
$BelowPosition = @DesktopHeight
If $Graphic[$i][21] <> "" Then
$Speed = $Graphic[$i][21]
Else
$Speed = 5
EndIf
Do
WinMove($Graphic[$i][11], "", $Graphic[$i][3], $BelowPosition)
Sleep($Speed)
$BelowPosition = $BelowPosition - $Graphic[$i][4] / 20
Until $BelowPosition <= $Graphic[$i][4]
$Graphic[$i][4] = $BelowPosition
Else
GUISetState(@SW_SHOW)
EndIf
ElseIf $State = "Hide" Then
GUISetState(@SW_HIDE)
ElseIf $State = "Minimize" Then
GUISetState(@SW_MINIMIZE)
EndIf
EndIf
EndIf
Next
EndFunc ;==>_SetState
Func _SetOption($Id, $Option, $Option2 = "")
For $i = 0 To UBound($Graphic) - 1
If $Id = $Graphic[$i][2] Then
If $Graphic[$i][13] = "Form" Then
If $Option = "EffectOnLeft" Then
$Graphic[$i][20] = "OnLeft"
If $Option2 <> "" Then $Graphic[$i][21] = $Option2
ElseIf $Option = "EffectOnRight" Then
$Graphic[$i][20] = "OnRight"
If $Option2 <> "" Then $Graphic[$i][21] = $Option2
ElseIf $Option = "EffectOnAbove" Then
$Graphic[$i][20] = "OnAbove"
If $Option2 <> "" Then $Graphic[$i][21] = $Option2
ElseIf $Option = "EffectOnBelow" Then
$Graphic[$i][20] = "OnBelow"
If $Option2 <> "" Then $Graphic[$i][21] = $Option2
ElseIf $Option = "EffectOff" Then
$Graphic[$i][20] = ""
$Graphic[$i][21] = ""
EndIf
EndIf
EndIf
Next
EndFunc ;==>_SetOption
Funktionen
Spoiler anzeigen
_NewForm($Id, $Text, $Left, $Top, $Width, $Height,[$Color],[$BgColor],[$FormBgColor]) ;Erstellt ein GUI
_NewLabel($Id, $Text, $Left, $Top,[$Width],[$Height],[$BgColor]) ;Erstellt ein Label
_NewTextField($Id, $Text, $Left, $Top,[$Width],[$Height],[$Color],[$BgColor]) ;Erstellt ein Textfeld
_NewButton($Id, $Text, $Left, $Top,[$Width],[$Height],[$Color],[$BgColor]) ;Erstellt ein Button
_NewProgressBar($Id, $Left, $Top,[$Width],[$Height],[$Color],[$BgColor],[$ContentColor],[$Position]);Erstellt eine ProgressBar
_NewMessagesBox([$Title],[$Content],[$ButtonContent]) ;Erstellt eine MessagesBox
_NewInputBox([$Title],[$Content],[$ButtonContent]) ;Erstellt eine InputBox
_SetPosition($Id, $Position) ;Ändert die Ladebalkenposition des Controls
_SetBgColor($Id, $BgColor) ;Ändert die Hintergrundfarbe des Controls
_SetText($Id, $Text) ;Ändert den Text des Controls
_SetColor($Id, $Color) ;Ändert die Rahemenfarbe des Controls
_SetContentColor($Id, $ContentColor) ;Ändert die Ladebalkenfarbe
_SetBounds($Id,[$Left],[$Top],[$Width],[$Height]) ;Ändert die Position des Controls
_SetAllColors($Color) ;Ändert von allen Controls die Rahmenfarbe
_SetAllBgColors($BgColor) ;Ändert von allen Controls die Hintergrundfarbe
_SetAllPositions($Position) ;Ändert alle Ladebalkenpositionen
_SetAllContentColors($ContentColor) ;Ändern alle Ladebalkenfarben
_SetForm($Id) ;Aktualisiert die Position der Form WICHTIG: Damit sich die Form bewegt muss die Funktion in einer wiederholenden Schleife sein
_SetState($Id, $State) ;Setzt Status für das Control
_SetOption($Id, $Option,[$Option2]) ;Setzt Eigenschaften für das Control
_SetFormBgColor($Id, $FormBgColor) ;Ändert die Hintergrundfarbe der Form
_GetContentColor($Id) ;Holt Ladebalkenfarbe der ID
_GetColor($Id) ;Holt Rahmenfarbe der ID
_GetBgColor($Id) ;Holt Hintergrundfarbe der ID
_GetPosition($Id) ;Holt die Ladebalkenposition
_GetText($Id) ;Holt Text der ID
_GetBounds($Id) ;Holt Position der ID
_GetHandle($Id) ;Holt Handle der ID
_GetFormBgColor($Id) ;Holt Hindergrundfarbe des Form
_GetCloseButtonHandle($Id) ;Holt vom Schließbutton das Handle
_GetMinimizeButtonHandle($Id) ;Holt vom Minmierbutton das Handle
_GetGraphics() ;Zeigt alle erstellten Controls und dazugehörige eigenschaften an
$Id ;Bei GET und SET die ID die beeinflusst, benutzt werden soll bei NEW wird die ID bestimmt
$Text ;Text im Control
$Left ;Position des Controls von Links
$Top ;Position des Controls von Oben
$Width ;Breite des Controls
$Height ;Höhe des Controls
$Color ;Rahmenfarbe des Controls
$BgColor ;Hintergrundfarbe des Controls
$FormBgColor ;Hintergrundfarbe der GUI
$ContentColor ;Farbe vom Ladebalken
$Position ;Position vom Ladebalken (0-100)
$Title ;Title von MessagesBox oder InputBox
$Content ;Text von MessagesBox oder InputBox
$ButtonContent ;Text des Buttons in MessagesBox oder InputBox
$Option ;Eigenschaft ("EffectOff" = Effekt wird gelöscht)("EffectOnLeft" = Wenn GUI gezeigt wird kommt sie von Links hereingefahren)("EffectOnRight" = Wenn GUI gezeigt wird kommt sie von Rechts hereingefahren)("EffectOnBelow" = Wenn GUI gezeigt wird kommt sie von Unten hereingefahren)("EffectOnAbove" = Wenn GUI gezeigt wird kommt sie von Oben hereingefahren)
$Option2 ;Zweite Eigenschaft (Geschwindigkeit beim Effekt)
$State ;Status ("Show" = zeigt GUI)("Hide" = versteckt GUI)("Minimize" = minimiert GUI)
Fragen zu Bugs
Spoiler anzeigen
1. Warumm kann man bei
GUICtrlSetPos()
[/autoit]die Breite nicht auf null setzten
2. Wie kann ich es machen das nur wenn das Fenster aktiv ist es bewegbar ist so gings nicht
If WinGetState(>>>Title<<<) = 2 Then
EndIf
hat sich erledigt
3. Warumm stimmt der Returnwert der InputBox nicht