Hab mal wieder was kleines gebastelt. Vllt gefällt es ja dem einen oder anderen.
mfg funkey
Spoiler anzeigen
Local $hGui = GUICreate("GuiCtrlLCDNumber by funkey", 800)
[/autoit] [autoit][/autoit] [autoit]Local $LCDNum1 = _GuiCtrlLCDNumber_Create(10, 10, 20, 30, 10, 0xff0000, 0xafafa0)
_GuiCtrlLCDNumber_SetValue($LCDNum1, "0123456789")
Local $LCDNum2 = _GuiCtrlLCDNumber_Create(10, 70, 20, 40, 6)
[/autoit] [autoit][/autoit] [autoit]Local $LCDNum3 = _GuiCtrlLCDNumber_Create(10, 120, 120, 240, 6, 0xffa0, 0x0)
[/autoit] [autoit][/autoit] [autoit]_GuiCtrlLCDNumber_SetValue($LCDNum3, "345678")
If @error Then MsgBox(16, "Error " & @error, "The value you wanted to set is invalid!", 0, $hGui)
GUISetState()
[/autoit] [autoit][/autoit] [autoit]AdlibRegister("_Update", 1000)
[/autoit] [autoit][/autoit] [autoit]Do
Sleep(20)
Until GUIGetMsg() = -3
Func _Update()
_GuiCtrlLCDNumber_SetValue($LCDNum2, StringFormat("%s%s%s", @hour, @min, @SEC))
EndFunc
Func _GuiCtrlLCDNumber_Create($x, $y, $w = 20, $h = 40, $iCount = 1, $iCol = 0, $iBkCol = Default)
Local $aRet[3] = [GUICtrlCreateDummy()]
Local $iThick = $w / 8
For $i = 0 To $iCount - 1
GUICtrlCreateGraphic($x + $i * $w, $y, $w, $h, 0)
GUICtrlSetBkColor(-1, $iBkCol)
GUICtrlCreateGraphic($x + $i * $w, $y, $w, $h, 0)
GUICtrlSetGraphic(-1, 24, $iThick) ;$GUI_GR_PENSIZE
GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
GUICtrlSetGraphic(-1, 6, 1.5*$iThick, $iThick) ;$GUI_GR_MOVE
GUICtrlSetGraphic(-1, 2, $w - 1.5*$iThick, $iThick) ;$GUI_GR_LINE
GUICtrlSetGraphic(-1, 24, $iThick/2) ;$GUI_GR_PENSIZE
GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
GUICtrlSetGraphic(-1, 14, $iThick, $iThick, $iThick/2, -30, 60) ;$GUI_GR_PIE
GUICtrlSetGraphic(-1, 14, $w - $iThick, $iThick, $iThick/2, 150, 60) ;$GUI_GR_PIE
GUICtrlCreateGraphic($x + $i * $w, $y, $w, $h, 0)
GUICtrlSetGraphic(-1, 24, $iThick) ;$GUI_GR_PENSIZE
GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
GUICtrlSetGraphic(-1, 6, 1.5*$iThick, $h/2) ;$GUI_GR_MOVE
GUICtrlSetGraphic(-1, 2, $w - 1.5*$iThick, $h/2) ;$GUI_GR_LINE
GUICtrlSetGraphic(-1, 24, $iThick/2) ;$GUI_GR_PENSIZE
GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
GUICtrlSetGraphic(-1, 14, $iThick, $h/2, $iThick/2, -30, 60) ;$GUI_GR_PIE
GUICtrlSetGraphic(-1, 14, $w - $iThick, $h/2, $iThick/2, 150, 60) ;$GUI_GR_PIE
GUICtrlCreateGraphic($x + $i * $w, $y, $w, $h, 0)
GUICtrlSetGraphic(-1, 24, $iThick) ;$GUI_GR_PENSIZE
GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
GUICtrlSetGraphic(-1, 6, 1.5*$iThick, $h-$iThick) ;$GUI_GR_MOVE
GUICtrlSetGraphic(-1, 2, $w - 1.5*$iThick, $h-$iThick) ;$GUI_GR_LINE
GUICtrlSetGraphic(-1, 24, $iThick/2) ;$GUI_GR_PENSIZE
GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
GUICtrlSetGraphic(-1, 14, $iThick, $h-$iThick, $iThick/2, -30, 60) ;$GUI_GR_PIE
GUICtrlSetGraphic(-1, 14, $w - $iThick, $h-$iThick, $iThick/2, 150, 60) ;$GUI_GR_PIE
GUICtrlCreateGraphic($x + $i * $w, $y, $w, $h, 0)
GUICtrlSetGraphic(-1, 24, $iThick) ;$GUI_GR_PENSIZE
GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
GUICtrlSetGraphic(-1, 6, $iThick/1.5, 2*$iThick) ;$GUI_GR_MOVE
GUICtrlSetGraphic(-1, 2, $iThick/1.5, $h/2 - $iThick) ;$GUI_GR_LINE
GUICtrlSetGraphic(-1, 24, $iThick/2) ;$GUI_GR_PENSIZE
GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
GUICtrlSetGraphic(-1, 14, $iThick/1.5, 1.5*$iThick, $iThick/2, -120, 60) ;$GUI_GR_PIE
GUICtrlSetGraphic(-1, 14, $iThick/1.5, $h/2 - $iThick/2, $iThick/2, 60, 60) ;$GUI_GR_PIE
GUICtrlCreateGraphic($x + $i * $w, $y, $w, $h, 0)
GUICtrlSetGraphic(-1, 24, $iThick) ;$GUI_GR_PENSIZE
GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
GUICtrlSetGraphic(-1, 6, $w - $iThick/1.5, 2*$iThick) ;$GUI_GR_MOVE
GUICtrlSetGraphic(-1, 2, $w - $iThick/1.5, $h/2 - $iThick) ;$GUI_GR_LINE
GUICtrlSetGraphic(-1, 24, $iThick/2) ;$GUI_GR_PENSIZE
GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
GUICtrlSetGraphic(-1, 14, $w - $iThick/1.5, 1.5*$iThick, $iThick/2, -120, 60) ;$GUI_GR_PIE
GUICtrlSetGraphic(-1, 14, $w - $iThick/1.5, $h/2 - $iThick/2, $iThick/2, 60, 60) ;$GUI_GR_PIE
GUICtrlCreateGraphic($x + $i * $w, $y, $w, $h, 0)
GUICtrlSetGraphic(-1, 24, $iThick) ;$GUI_GR_PENSIZE
GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
GUICtrlSetGraphic(-1, 6, $iThick/1.5, $h/2 + $iThick) ;$GUI_GR_MOVE
GUICtrlSetGraphic(-1, 2, $iThick/1.5, $h - 2*$iThick) ;$GUI_GR_LINE
GUICtrlSetGraphic(-1, 24, $iThick/2) ;$GUI_GR_PENSIZE
GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
GUICtrlSetGraphic(-1, 14, $iThick/1.5, $h/2 + $iThick/2, $iThick/2, -120, 60) ;$GUI_GR_PIE
GUICtrlSetGraphic(-1, 14, $iThick/1.5, $h - 1.5*$iThick, $iThick/2, 60, 60) ;$GUI_GR_PIE
GUICtrlCreateGraphic($x + $i * $w, $y, $w, $h, 0)
GUICtrlSetGraphic(-1, 24, $iThick) ;$GUI_GR_PENSIZE
GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
GUICtrlSetGraphic(-1, 6, $w - $iThick/1.5, $h/2 + $iThick) ;$GUI_GR_MOVE
GUICtrlSetGraphic(-1, 2, $w - $iThick/1.5, $h - 2*$iThick) ;$GUI_GR_LINE
GUICtrlSetGraphic(-1, 24, $iThick/2) ;$GUI_GR_PENSIZE
GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
GUICtrlSetGraphic(-1, 14, $w - $iThick/1.5, $h/2 + $iThick/2, $iThick/2, -120, 60) ;$GUI_GR_PIE
GUICtrlSetGraphic(-1, 14, $w - $iThick/1.5, $h - 1.5*$iThick, $iThick/2, 60, 60) ;$GUI_GR_PIE
Next
$aRet[1] = GUICtrlCreateDummy()
Return $aRet
EndFunc
Func _GuiCtrlLCDNumber_SetValue(ByRef $hLCDNumber, $sValue)
If Not StringIsInt($sValue) Then Return SetError(1)
Local $iDigits = ($hLCDNumber[1] - $hLCDNumber[0] -1) / 8
If StringLen($sValue) > $iDigits Then Return SetError(2)
$sValue = StringFormat("%0" & $iDigits & "s", $sValue)
Local $aValue = StringSplit($sValue, "", 2)
For $i = 0 To $iDigits - 1
If StringMid($hLCDNumber[2], $i + 1, 1) = $aValue[$i] Then ContinueLoop
Switch $aValue[$i]
Case 0
GUICtrlSetState($hLCDNumber[0] + 2 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 3 + $i*8, 32)
GUICtrlSetState($hLCDNumber[0] + 4 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 5 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 6 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 7 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 8 + $i*8, 16)
Case 1
GUICtrlSetState($hLCDNumber[0] + 2 + $i*8, 32)
GUICtrlSetState($hLCDNumber[0] + 3 + $i*8, 32)
GUICtrlSetState($hLCDNumber[0] + 4 + $i*8, 32)
GUICtrlSetState($hLCDNumber[0] + 5 + $i*8, 32)
GUICtrlSetState($hLCDNumber[0] + 6 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 7 + $i*8, 32)
GUICtrlSetState($hLCDNumber[0] + 8 + $i*8, 16)
Case 2
GUICtrlSetState($hLCDNumber[0] + 2 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 3 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 4 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 5 + $i*8, 32)
GUICtrlSetState($hLCDNumber[0] + 6 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 7 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 8 + $i*8, 32)
Case 3
GUICtrlSetState($hLCDNumber[0] + 2 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 3 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 4 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 5 + $i*8, 32)
GUICtrlSetState($hLCDNumber[0] + 6 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 7 + $i*8, 32)
GUICtrlSetState($hLCDNumber[0] + 8 + $i*8, 16)
Case 4
GUICtrlSetState($hLCDNumber[0] + 2 + $i*8, 32)
GUICtrlSetState($hLCDNumber[0] + 3 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 4 + $i*8, 32)
GUICtrlSetState($hLCDNumber[0] + 5 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 6 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 7 + $i*8, 32)
GUICtrlSetState($hLCDNumber[0] + 8 + $i*8, 16)
Case 5
GUICtrlSetState($hLCDNumber[0] + 2 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 3 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 4 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 5 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 6 + $i*8, 32)
GUICtrlSetState($hLCDNumber[0] + 7 + $i*8, 32)
GUICtrlSetState($hLCDNumber[0] + 8 + $i*8, 16)
Case 6
GUICtrlSetState($hLCDNumber[0] + 2 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 3 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 4 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 5 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 6 + $i*8, 32)
GUICtrlSetState($hLCDNumber[0] + 7 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 8 + $i*8, 16)
Case 7
GUICtrlSetState($hLCDNumber[0] + 2 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 3 + $i*8, 32)
GUICtrlSetState($hLCDNumber[0] + 4 + $i*8, 32)
GUICtrlSetState($hLCDNumber[0] + 5 + $i*8, 32)
GUICtrlSetState($hLCDNumber[0] + 6 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 7 + $i*8, 32)
GUICtrlSetState($hLCDNumber[0] + 8 + $i*8, 16)
Case 8
GUICtrlSetState($hLCDNumber[0] + 2 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 3 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 4 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 5 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 6 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 7 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 8 + $i*8, 16)
Case 9
GUICtrlSetState($hLCDNumber[0] + 2 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 3 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 4 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 5 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 6 + $i*8, 16)
GUICtrlSetState($hLCDNumber[0] + 7 + $i*8, 32)
GUICtrlSetState($hLCDNumber[0] + 8 + $i*8, 16)
EndSwitch
Next
$hLCDNumber[2] = $sValue
EndFunc