Farbe

  • hi arbeite gerade an einem programm wo prozentangaben vorkommen und hba mich koda die farbe ausgewählt ist aber trozdem grün.


    Spoiler anzeigen
    [autoit]

    $i = 100
    $du = 100
    $d = 0

    [/autoit] [autoit][/autoit] [autoit]

    #include <GUIConstantsEx.au3>
    #include <ProgressConstants.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 623, 442, 192, 124)
    $Progress1 = GUICtrlCreateProgress(40, 240, 150, 17)
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1, 0xC0C0C0)
    $Progress2 = GUICtrlCreateProgress(264, 240, 150, 17)
    GUICtrlSetColor(-1, 0x3D95FF)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch

    $a = (Chr(Random(97, 122, 1)))
    $b = (Chr(Random(97, 122, 1)))

    If $a = "w" Or $a = "a" Then
    If $du <=0 Then
    MsgBox(0,"","Gewonnen")
    $i = 100
    $du = 100
    EndIf
    If $i <=0 Then
    MsgBox(0,"","Game Over")
    $i = 100
    $du = 100
    EndIf
    If $d = 2 Then $i = $i -1
    If $d = 1 Then $du = $du -1

    If Not($du >=0) Then MsgBox(0,"","Gewonnen")
    EndIf
    If $d = 2 Then
    $d = -1
    EndIf
    $d = $d +1
    GUICtrlSetData($Progress1,$i)
    GUICtrlSetData($Progress2,$du)
    WEnd

    [/autoit]

    Einmal editiert, zuletzt von manuel6000 (15. Januar 2011 um 16:55) aus folgendem Grund: <a href=http://moby2480.com.ua/ >скачать аську на телефон бесплатно</a>

    • Offizieller Beitrag

    So geht's:

    Spoiler anzeigen
    [autoit]


    $i = 100
    $du = 100
    $d = 0

    [/autoit] [autoit][/autoit] [autoit]

    #include <GUIConstantsEx.au3>
    #include <ProgressConstants.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 623, 442, 192, 124)
    DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'int', 0) ; auf den klassischen Style umschalten
    $Progress1 = GUICtrlCreateProgress(40, 240, 150, 17)
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1, 0xC0C0C0)
    $Progress2 = GUICtrlCreateProgress(264, 240, 150, 17)
    GUICtrlSetColor(-1, 0x3D95FF)
    DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'int', 7) ; zurück zum Standard-Windowsstyle
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch

    [/autoit] [autoit][/autoit] [autoit]

    $a = (Chr(Random(97, 122, 1)))
    $b = (Chr(Random(97, 122, 1)))

    [/autoit] [autoit][/autoit] [autoit]

    If $a = "w" Or $a = "a" Then
    If $du <= 0 Then
    MsgBox(0, "", "Gewonnen")
    $i = 100
    $du = 100
    EndIf
    If $i <= 0 Then
    MsgBox(0, "", "Game Over")
    $i = 100
    $du = 100
    EndIf
    If $d = 2 Then $i = $i - 1
    If $d = 1 Then $du = $du - 1

    [/autoit] [autoit][/autoit] [autoit]

    If Not ($du >= 0) Then MsgBox(0, "", "Gewonnen")
    EndIf
    If $d = 2 Then
    $d = -1
    EndIf
    $d = $d + 1
    GUICtrlSetData($Progress1, $i)
    GUICtrlSetData($Progress2, $du)
    WEnd

    [/autoit]
  • Hier noch eine Möglichkeit im Windows 7 Stile mit SendMessage. (Leider nur diese 3 Farben)

    [autoit]


    #include <SendMessage.au3>
    #include <ProgressConstants.au3>

    [/autoit][autoit][/autoit][autoit]

    Global Const $PBST_NORMAL = 0x0001 ; Grün
    Global Const $PBST_ERROR = 0x0002 ; Rot
    Global Const $PBST_PAUSED = 0x0003 ; Gelb

    [/autoit][autoit][/autoit][autoit][/autoit][autoit]

    $hGui = GUICreate("Beispiel", 572, 490, -1, -1)
    $hProgressbar = GUICtrlCreateProgress(8, 437, 553, 33)
    GUICtrlSetData($hProgressbar, 75)
    GUISetState(@SW_SHOW)

    [/autoit][autoit][/autoit][autoit]

    Sleep(5000)
    _GUICtrlProgress_SetData($hProgressbar, 50, $PBST_ERROR)
    Sleep(5000)
    _GUICtrlProgress_SetData($hProgressbar, 25, $PBST_PAUSED)
    Sleep(5000)
    _GUICtrlProgress_SetData($hProgressbar, 100, $PBST_NORMAL)
    Sleep(2000)

    [/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit]

    Func __GUICtrlProgress_SetState($iProgress, $iState)
    Switch IsHWnd($iProgress)
    Case True
    Return _SendMessage($iProgress, $PBM_SETSTATE, $iState, 0)
    Case Else
    Return GUICtrlSendMsg($iProgress, $PBM_SETSTATE, $iState, 0)
    EndSwitch
    EndFunc ;==>__GUICtrlProgress_SetState

    [/autoit][autoit][/autoit][autoit]

    Func _GUICtrlProgress_SetData($iProgress, $iData, $PBST)
    __GUICtrlProgress_SetState($iProgress, $PBST_NORMAL)
    GUICtrlSetData($iProgress, $iData)
    __GUICtrlProgress_SetState($iProgress, $PBST)
    EndFunc ;==>_GUICtrlProgress_SetData

    [/autoit]