FMS Posted May 7, 2010 Share Posted May 7, 2010 (edited) Dear reader, I've a problem whit getting a picture in the background of a listvieuw. It shoot work whitout Local $sURL = "http://www.autoitscript.com/autoit3/files/graphics/autoit9_wall_grey_800x600.jpg" Local $sFilePath = @ScriptDir & "\AutoIt.jpg" InetGet($sURL, $sFilePath) this is what i got this far but cant ad the picture iff i dont put in the InetGet command in the script :S expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <File.au3> #include <Array.au3 > ;***************************************************************************************************************************** #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> ;***************************************************************************************************************************** Switch @HOUR Case 6 To 11 $welkom = "Goedemorgen" Case 12 To 17 $welkom = "Goedemiddag" Case 18 To 21 $welkom = "Goede avond" Case Else $welkom = "Wat doe je nog hier?" EndSwitch ;***************************************************************************************************************************** $Form1 = GUICreate("Testje", 570, 150, 277, 322) $Tab1 = GUICtrlCreateTab(8, 8, 545, 129) GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) ;***************************************************************************************************************************** $TabSheet1 = GUICtrlCreateTabItem("THT") ;***************************************************************************************************************************** $LabelNVInr = GUICtrlCreateLabel($welkom & @CRLF & "please here your search query", 25, 50, 226, 30) $BCancel = GUICtrlCreateButton("Cancel", 30, 89, 137, 25, $WS_GROUP) $BInvetory = GUICtrlCreateButton("Invetory", 222, 90, 137, 25, BitOR($BS_CENTER, $BS_PUSHLIKE, $BS_MULTILINE, $WS_GROUP)) $BConnect = GUICtrlCreateButton("Connect", 400, 87, 137, 25, BitOR($BS_DEFPUSHBUTTON, $WS_GROUP)) $INVInr = GUICtrlCreateInput("harry", 304, 56, 233, 21) ;***************************************************************************************************************************** $TabSheet2 = GUICtrlCreateTabItem("Setup") ;***************************************************************************************************************************** $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 12, 41, 17, 17) GUICtrlSetState(-1, $GUI_CHECKED) $LabelTDfile = GUICtrlCreateLabel("Location of TD database file", 36, 41, 154, 17) $InputTDfile = GUICtrlCreateInput("c:\Temp\TDfile.txt", 196, 41, 337, 21, BitOR($ES_UPPERCASE, $ES_AUTOHSCROLL)) ;***************************************************************************************************************************** $Checkbox2 = GUICtrlCreateCheckbox("Checkbox1", 12, 65, 17, 17) GUICtrlSetState(-1, $GUI_CHECKED) $LabelVCfile = GUICtrlCreateLabel("Location of VC database file", 36, 65, 153, 17) $InputVCfile = GUICtrlCreateInput("c:\Temp\VCfile.txt", 196, 65, 337, 21) ;***************************************************************************************************************************** $InputNVItemp = GUICtrlCreateInput("Input1", 112, 101, 97, 21) $LabelNVItemp = GUICtrlCreateLabel("NVI nr template", 16, 100, 77, 17) ;***************************************************************************************************************************** $RadioVNC = GUICtrlCreateRadio("Radio1", 232, 104, 17, 17) GUICtrlSetState(-1, $GUI_CHECKED) $Label4 = GUICtrlCreateLabel("VNC", 264, 104, 26, 17) $RadioRDP = GUICtrlCreateRadio("Radio2", 312, 104, 17, 17) $Label5 = GUICtrlCreateLabel("RDP (under construction)", 344, 104, 124, 17) ;***************************************************************************************************************************** GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) Dim $Form1_1_AccelTable[3][2] = [["^c", $BCancel],["^e", $BInvetory],["^d", $BConnect]] GUISetAccelerators($Form1_1_AccelTable) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $BCancel Exit Case $BInvetory Exit Case $BConnect ;Read_file() ;#comments-start ; Read files into arrays Global $aVC_Array, $aTD_Array _FileReadToArray(GUICtrlRead($InputVCfile), $aVC_Array) _FileReadToArray(GUICtrlRead($InputTDfile), $aTD_Array) ; Search arrays for the key word $sKey = GUICtrlRead($INVInr) $aIndex_VC = _ArrayFindAll($aVC_Array, $sKey, 0, 0, 0, 1) If Not IsArray($aIndex_VC) Then Global $aIndex_VC[1] = ["Not Found VC"] $aIndex_TD = _ArrayFindAll($aTD_Array, $sKey, 0, 0, 0, 1) If Not IsArray($aIndex_TD) Then Global $aIndex_TD[1] = ["Not Found TD"] ;#comments-end form_output() ;use UDF built listview EndSwitch WEnd Func form_output() Local $GUI, $hImage, $aImage, $hListView Local $exStyles = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER) ;********************************************************************************************************Only if i put this in i get a picture :S Local $sURL = "http://www.autoitscript.com/autoit3/files/graphics/autoit9_wall_grey_800x600.jpg" Local $sFilePath = @ScriptDir & "\AutoIt.jpg" InetGet($sURL, $sFilePath) ;******************************************************************************************************** $GUI = GUICreate("(UDF Created) ListView Set Background Image", 574, 520) ; Create VC LV GUICtrlCreateLabel("VC Results", 10, 10, 100, 20) $hVC_ListView = _GUICtrlListView_Create($GUI, "Person|Street|Best in|Number|Skill", 10, 30, 554, 200) ; Set widths For $i = 0 To 4 _GUICtrlListView_SetColumnWidth($hVC_ListView, $i, 110) Next ; Fill elements If $aIndex_VC[0] = "Not Found VC" Then _GUICtrlListView_AddItem($hVC_ListView, "Not found") Else ; Extract the lines from the file For $i = 0 To UBound($aIndex_VC) - 1 ; For each index in the array $aItems = StringSplit($aVC_Array[$aIndex_VC[$i]], "|") $iLine = _GUICtrlListView_AddItem($hVC_ListView, $aItems[1]) For $j = 2 To $aItems[0] _GUICtrlListView_AddSubItem($hVC_ListView, $iLine, $aItems[$j], $j - 1) Next Next EndIf ; Set background image _GUICtrlListView_SetBkImage($hVC_ListView, "C:\Temp\backgroundVM.jpg");******************location jpg file ; Create TD LV GUICtrlCreateLabel("TD Results", 10, 250, 100, 20) $hTD_ListView = _GUICtrlListView_Create($GUI, "Person|Street|Best in|Number|Skill", 10, 230, 554, 200) ; Set widths For $i = 0 To 4 _GUICtrlListView_SetColumnWidth($hTD_ListView, $i, 110) Next ; Fill elements If $aIndex_TD[0] = "Not Found TD" Then _GUICtrlListView_AddItem($hTD_ListView, "Not found") Else ; Extract the lines from the file For $i = 0 To UBound($aIndex_TD) - 1 ; For each index in the array $aItems = StringSplit($aTD_Array[$aIndex_TD[$i]], "|") $iLine = _GUICtrlListView_AddItem($hTD_ListView, $aItems[1]) ConsoleWrite($iLine & @CRLF) For $j = 2 To $aItems[0] _GUICtrlListView_AddSubItem($hTD_ListView, $iLine, $aItems[$j], $j - 1) Next Next EndIf ; Set background image _GUICtrlListView_SetBkImage($hTD_ListView, "C:\Temp\backgroundTD.jpg");******************location jpg file $hOK_Button = GUICtrlCreateButton("OK", 480, 480, 80, 30) GUISetState() While 1 If GUIGetMsg() = $hOK_Button Then GUIDelete($GUI) Return EndIf WEnd EndFunc ;==>Example_UDF_Created I think this is odd that it only works iff i get a picture from the internet and cant find it localy :S Does anyone know what i m doing here wrong??? I want to get a picture localy and not from the internet whit kind regards, FMS ps, the file's where this script is searching for are : VCfile.txt VCfile.txt harry.potter.nl|local street|baseball|nr.14|expert mariska.pijnacker.nl|far out street|Soccerl|nr.14|novice plofje.trofje.nl|duda street|baseball|nr.133|expert hetje.fretje.nl|fre street|Soccer|nr.156|noob blaas.kaak.nl|asdfs street|baseball|nr.34|expert kees.kotter.nl|gsafsd street|Soccer|nr.24|novice klaas.plotter.nl|dsfa street|baseball|nr.14|expert jan.snotter.nl|gfdg street|football|nr.12|expert and TDFILE.txt TDFILE harry.snotter.nl|local street|baseball|nr.14|expert mariska.pijnacker.nl|far out street|Soccerl|nr.14|novice plofje.trofje.nl|duda street|baseball|nr.133|expert hetje.fretje.nl|fre street|Soccer|nr.156|noob blaas.kaak.nl|asdfs street|baseball|nr.34|expert kees.kotter.nl|gsafsd street|Soccer|nr.24|novice klaas.plotter.nl|dsfa street|baseball|nr.14|expert jan.snotter.nl|gfdg street|Baseball|nr.12|noob pls put the files in c:\Temp\*.* Edited May 7, 2010 by FMS as finishing touch god created the dutch Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now