Hallo Alle,
_GUICtrlListView_SetBkImage($hListView,$sFilePath)
$aImage=_GUICtrlListView_GetBkImage($hListView)
löschen die Bilder im angegebenen Ordner. Hat das jemand auch schon mal erlebt?
Mein eigentliches Problem ist, das ich in einem Listview einen eigenen Hintergrund haben möchte. (Bild)
Ich füge mal mein Script ein.
Spoiler anzeigen
#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>
#include <GuiListView.au3>
#include <Inet.au3>
#include <ListViewConstants.au3>
#include <String.au3>
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <string.au3>
#include <inet.au3>
#include <ListViewConstants.au3>
#include <GuiListView.au3>
#include <GUIConstantsEx.au3>
#include <String.au3>
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
Opt('MustDeclareVars', 1)
[/autoit] [autoit][/autoit] [autoit]$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work
global $zip[6] = ["76646","71032","66403","76227","67065","11083"]
global $hListView = ""
_Main()
Func _Main()
Local $hImage
$GUI = GUICreate("Arbeitsplatz-Wetter-Info", 600, 300)
; $pic = GUICtrlCreatePic("msde10081077bd1.jpg",2,2,588,298)
;$hListView = GUICtrlCreateListView("", 2, 2, 594, 268)
$hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 594, 268)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
$sFilePath = @ScriptDir & "\wetterhahn.jpg"
[/autoit] [autoit][/autoit] [autoit]; Set the Background Image
_GUICtrlListView_SetBkImage($hListView, $sFilePath)
GUISetState()
; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 146)
_GUICtrlListView_SetImageList($hListView, $hImage, 1)
[/autoit] [autoit][/autoit] [autoit]; Add columns
_GUICtrlListView_AddColumn($hListView, "Aktuell", 200)
_GUICtrlListView_AddColumn($hListView, "Grad", 50)
_GUICtrlListView_AddColumn($hListView, "Wind", 150)
_GUICtrlListView_AddColumn($hListView, "Feuchtigkeit", 150)
Display_Data()
AdlibRegister("Display_Data", 60000)
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main
Func CheckINet()
#cs
local $sIp
TCPStartup()
$sIp = TCPNameToIP("www.google.de")
;MsgBox(64, "sIP", $sIp & " ! " & @error)
TCPShutdown()
Return @error
#ce
$iResult = Ping("www.google.de")
Switch @error
Case 0
return 0
Case 1
return -1
Case 2
return -1
Case 3
return -1
Case 4
return -1
EndSwitch
return @error
EndFunc
Func _getXML_Weather_data($pcode)
Local $Api, $XML_Source, $Rc, $City, $Wstatus, $Temp, $Wind, $Humidity
$Api = "http://www.google.com/ig/api?weather=" & $pcode & ',Germany&hl=de'
$XML_Source = _INetGetSource($Api)
$Rc = _StringBetween($XML_Source, '<problem_cause data="', '"/>')
if $Rc <> "" Then
[/autoit] [autoit][/autoit] [autoit]Local $Sonst[5] = ["ist nicht gültig", "N/A", "N/A", "N/A", "N/A"]
Local $MyWeather[5] = [$Sonst[0], $Sonst[1], $Sonst[2] & " °C", $Sonst[3], $Sonst[4]]
Else
$City = _StringBetween($XML_Source, '<city data="', '"/>')
$Wstatus = _StringBetween($XML_Source, '<condition data="', '"/>')
$Temp = _StringBetween($XML_Source, '<temp_c data="', '"/>')
$Wind = _StringBetween($XML_Source, '<wind_condition data="', '"/>')
$Humidity = _StringBetween($XML_Source, '<humidity data="', '"/>')
;Return
Local $MyWeather[5] = [$City[0], $Wstatus[0], $Temp[0] & " °C", $Wind[0], $Humidity[0]]
endif
Return $MyWeather
EndFunc ;==>_getXML_Weather_data
Func Display_Data()
;- msgbox(64,"Display_Ddata","Display_Data" & @CRLF & "Handle: " & $hListView,1)
local $wetter[5]
; global $hListView
_GUICtrlListView_BeginUpdate($hListView)
_GUICtrlListView_EnableGroupView($hListView)
_GUICtrlListView_DeleteAllItems($hListView)
if (CheckINet()) Then
; Keine aktive Internetverbindung
_GUICtrlListView_AddItem($hListView, "Keine Internetverbindung", 0)
Else
for $x = 0 to UBound($zip)-1
; get data from inet
$wetter = _getXML_Weather_data($zip[$x])
; Add items
_GUICtrlListView_AddItem($hListView, $wetter[1])
_GUICtrlListView_InsertGroup($hListView, -1, $x, $zip[$x] & " " & $wetter[0])
_GUICtrlListView_AddSubItem($hListView, $x, $wetter[2], 1, 1)
_GUICtrlListView_AddSubItem($hListView, $x, $wetter[3], 2)
_GUICtrlListView_AddSubItem($hListView, $x, $wetter[4], 3, 4)
_GUICtrlListView_SetItemGroupID($hListView, $x, $x)
[/autoit] [autoit][/autoit] [autoit]Next
_GUICtrlListView_EndUpdate($hListView)
EndIf
EndFunc