Hintergrund Bild für´s Label (Die Grund Form)

  • Hallo wiedermal AutoIt´ler,

    dank viel Unterstützung durch blubbstar habe ich nun schon einen sehr schönen Code für meinen Rechner hinbekommen, aber habe wieder ein problem was ich nicht gelöst bekomme!

    Diesmal geht es wie die Überschrift schon sagt um ein dauerhaften Labelhintergund in Bild Form.
    Zwar habe ich es schonmal mit GUICtrlCreatePic hin bekommen ein Bild einzubringen, konnte dann jedoch die ListViewItems net mehr anwählen.

    Also das Bild soll ausgelesen werden aus volgendem Pfad:
    Data\Backround\Backround.jpg

    Wie gesagt es soll als Labelhintergrund sein und die gesammt grösse der Gui haben!

    Achso ja der Code ;) :

    Spoiler anzeigen

    #region
    #AutoIt3Wrapper_UseUpx=n
    #AutoIt3Wrapper_Res_LegalCopyright=Ghostleader and Team Almanach
    #endregion
    #region Includes
    #include <GUIConstantsEx.au3>
    #include <GUIConstants.au3>
    #include <WindowsConstants.au3>
    #include <ListviewConstants.au3>
    #include <EditConstants.au3>
    #include <GuiListView.au3>
    #include <StaticConstants.au3>
    #endregion Includes

    #region GUI + ListView
    $Form1 = GUICreate("Materialien Rechner", 633, 195, 193, 125)
    GUICtrlCreateLabel("© By Team and Friend´s", 440, 180, -1, 15)
    GUICtrlSetBkColor(-1, 15658734)
    GUICtrlCreateLabel(" ", 10, 10, 200, 170)
    GUICtrlSetBkColor(-1, 0)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $listview = GUICtrlCreateListView("Klick an was du hertellen willst!", 20, 20, 180, 150, $LVS_SINGLESEL, $LVS_EX_FULLROWSELECT)
    GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
    GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
    _GUICtrlListView_SetColumnWidth($listview, 0, 200)
    #endregion GUI + ListView

    #region ListViewItems Label Start
    $h_l1 = GUICtrlCreateLabel("", 460, 10, 230, 20)
    $h_l2 = GUICtrlCreateLabel("", 460, 30, 230, 20)
    $h_l3 = GUICtrlCreateLabel("", 460, 50, 230, 20)
    $FrageLabel = GUICtrlCreateLabel("", 225, 15, 220, 30)
    $GrundLabel = GUICtrlCreateLabel("", 225, 45, 220, 30)
    $FrageInput = GUICtrlCreateInput("", 230, 120, 200, 20, $ES_NUMBER)
    $FrageButton = GUICtrlCreateButton("Ok", 235, 150, 70, 20)
    $BeendenButton = GUICtrlCreateButton("Beenden", 320, 150, 100, 20)
    #endregion ListViewItems Label End

    #region ListViewItems start
    Global $iCurNum = ''
    Local $aDaten[45][7] = [["Salat", "Makaroni: ", 5, "Gurke: ", 10, "Zwiebel: ", 20], _
    ["test2", 10, 10, 10], _
    ["test3", 10, 10, 10], _
    ["test4", 10, 10, 10], _
    ["test5", 10, 10, 10], _
    ["test6", 10, 10, 10], _
    ["test7", 10, 10, 10], _
    ["test8", 10, 10, 10], _
    ["test9", 10, 10, 10], _
    ["test10", 10, 10, 10], _
    ["test11", 10, 10, 10], _
    ["test12", 10, 10, 10], _
    ["test13", 10, 10, 10], _
    ["test14", 10, 10, 10], _
    ["test15", 10, 10, 10], _
    ["test16", 10, 10, 10], _
    ["test17", 10, 10, 10], _
    ["test18", 10, 10, 10], _
    ["test19", 10, 10, 10], _
    ["test20", 10, 10, 10], _
    ["test21", 10, 10, 10], _
    ["test22", 10, 10, 10], _
    ["test23", 10, 10, 10], _
    ["test24", 10, 10, 10], _
    ["test25", 10, 10, 10], _
    ["test26", 10, 10, 10], _
    ["test27", 10, 10, 10], _
    ["test28", 10, 10, 10], _
    ["test29", 10, 10, 10], _
    ["test30", 10, 10, 10], _
    ["test31", 10, 10, 10], _
    ["test32", 10, 10, 10], _
    ["test33", 10, 10, 10], _
    ["test34", 10, 10, 10], _
    ["test35", 10, 10, 10], _
    ["test36", 10, 10, 10], _
    ["test37", 10, 10, 10], _
    ["test38", 10, 10, 10], _
    ["test39", 10, 10, 10], _
    ["test40", 10, 10, 10], _
    ["test41", 10, 10, 10], _
    ["test42", 10, 10, 10], _
    ["test43", 10, 10, 10], _
    ["test44", 10, 10, 10], _
    ["test45", 10, 10, 10]]
    Local $aLV[UBound($aDaten)]
    For $i = 0 To UBound($aLV) - 1
    $aLV[$i] = GUICtrlCreateListViewItem($aDaten[$i][0], $listview)
    Next

    GUISetState(@SW_SHOW)

    #endregion ListViewItems End


    #region While Schleifen
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE, $BeendenButton
    Exit
    Case $FrageButton
    GUICtrlSetData($h_l1, $aDaten[$iCurNum][1] & $aDaten[$iCurNum][2] * GUICtrlRead($FrageInput))
    GUICtrlSetData($h_l2, $aDaten[$iCurNum][3] & $aDaten[$iCurNum][4] * GUICtrlRead($FrageInput))
    GUICtrlSetData($h_l3, $aDaten[$iCurNum][5] & $aDaten[$iCurNum][6] * GUICtrlRead($FrageInput))
    EndSwitch
    For $i = 0 To UBound($aLV) - 1
    If $nMsg = $aLV[$i] Then
    $iCurNum = $i
    _Anzeige($aDaten[$i][0])
    EndIf
    Next
    WEnd
    Exit
    #endregion While Schleifen

    #region Functionen
    Func _Anzeige($sName)
    GUICtrlSetState($FrageInput, $GUI_SHOW)
    GUICtrlSetState($FrageButton, $GUI_SHOW)
    GUICtrlSetState($BeendenButton, $GUI_SHOW)
    GUICtrlSetData($FrageLabel, StringReplace("Wie viel %sName% möchtest du herstellen?", "%sName%", $sName))
    GUICtrlSetData($GrundLabel, StringReplace("Für ein %sName% wird folgendes benötigt!", "%sName%", $sName))
    EndFunc ;==>_Anzeige

    #endregion Functionen

    Mfg Ghostleader

    Einmal editiert, zuletzt von Ghostleader (5. Juli 2011 um 16:46)

  • Wie auch in der Hilfe steht musst du das Bild auf $GUI_DISABLE setzen und die Listview auf $GUI_ONTOP
    Hilfe lesen :P

    Und das

    [autoit]

    EndSwitch
    For $i = 0 To UBound($aLV) - 1
    If $nMsg = $aLV[$i] Then
    $iCurNum = $i
    _Anzeige($aDaten[$i][0])
    EndIf
    Next

    [/autoit]

    würde ich durch das

    [autoit]

    Case $aLV[0] To $aLV[Ubound($aLV)-1]
    _Anzeige(GUICtrlRead($nMsg))
    EndSwitch

    [/autoit]


    ersetzen ;)