Rodger Posted November 5, 2013 Share Posted November 5, 2013 (edited) Hello, Does somebody know how I can capture an expanded TreeView as a whole which can be scrolled up and down as an image and save this image to a file ? Thank you. Rodger Edited November 5, 2013 by Rodger Link to comment Share on other sites More sharing options...
l3ill Posted November 5, 2013 Share Posted November 5, 2013 If you mean what I think you mean... ...Irfanview has a function that will allow such captures. Quasi Vertical Panorama Image. From the IrfanView help file Create Panorama image Click on the Image Menu, then Create Panorama image. A dialog allows you to create a panorama image. You can add single images vertically or horizontally. The first image in the chain will be used as the base for the next images. There is also an option to insert filenames into the panorama image (top left corner of the single image) or add some empty space between the images. 0 pixels means no space (default). Note: If you want to create images with multiple rows/columns at same time, use the Contact Sheet feature from Thumbnails window. My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
l3ill Posted November 5, 2013 Share Posted November 5, 2013 And if that is what you are looking for and want to script it... >check out this post It is designed to capture an entire webpage no matter how long, I assume it could be adapted to do what you are going for as well. Good luck ! Bill My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
Rodger Posted November 6, 2013 Author Share Posted November 6, 2013 (edited) Thanks for the response. I will look at the suggestions you made. It concerns a treeview made with autoit (GUICtrlCreateTreeView). Edited November 6, 2013 by Rodger Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 6, 2013 Moderators Share Posted November 6, 2013 Rodger,In that case you should be able to read the treeview content into a list and scroll it that way. I will see what I can come up with this afternoon. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 6, 2013 Moderators Share Posted November 6, 2013 Rodger,This seems to work quite well: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <GuiListBox.au3> #include <GuiTreeView.au3> #include <String.au3> #include <StaticConstants.au3> $hGUI = GUICreate("Test", 500, 500) GUISetBkColor(0xC4C4C4) $cTV = GUICtrlCreateTreeView(10, 10, 230, 200) For $i1 = 0 To 9 $cItem = GUICtrlCreateTreeViewItem("Item " & $i1, $cTV) For $i2 = 0 To 9 $cSubItem = GUICtrlCreateTreeViewItem("SubItem " & $i1 & $i2, $cItem) For $i3 = 0 To 9 GUICtrlCreateTreeViewItem("SubSubItem " & $i1 & $i2 & $i3, $cSubItem) Next Next Next $cList = GUICtrlCreateList("", 260, 10, 230, 210, BitOr($WS_BORDER, $WS_VSCROLL)) ; Omit $LBS_SORT $cButton = GUICtrlCreateButton("Image Treeview", 10, 300, 100, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton $hItem = _GUICtrlTreeView_GetFirstItem($cTV) If $hItem Then _TV_Image($hGUI, $cList, $cTV, $hItem) Else MsgBox($MB_SYSTEMMODAL +$MB_ICONERROR, "Oops", "TreeView is empty") EndIf EndSwitch WEnd Func _TV_Image($hGUI, $cList, $cTV, $hItem) _GUICtrlListBox_BeginUpdate($cList) $aPos = ControlGetPos($hGUI, "", $cList) $cLabel = GUICtrlCreateLabel("Working", $aPos[0], $aPos[1], $aPos[2], $aPos[3], BitOr($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetBkColor($cLabel, 0xFFFFFF) $hItem = _GUICtrlTreeView_GetFirstItem($cTV) Do _Image_Item($cList, $cTV, $hItem) $hItem = _GUICtrlTreeView_GetNextSibling($cTV, $hItem) Until $hItem = 0 GUICtrlDelete($cLabel) _GUICtrlListBox_EndUpdate($cList) EndFunc Func _Image_Item($cList, $cTV, $hItem) Do $sText = _GuiCtrlTreeView_GetText($cTV, $hItem) $iLevel = _GuiCtrlTreeView_Level($cTV, $hItem) $sLevel = "" If $iLevel Then $sLevel = _StringRepeat("--- ", $iLevel) EndIf _GUICtrlListBox_AddString($cList, $sLevel & $sText) $hItem = _GuiCtrlTreeView_GetNext($cTV, $hItem) Until $hItem = 0 EndFuncI hope it is clear enough to follow without comments, but please do ask if there is anything you do not understand. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
KaFu Posted November 6, 2013 Share Posted November 6, 2013 Based on >this example by wraithdu and the standard help-file example for GUICtrlCreateListView(). expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <WinAPI.au3> #include <SendMessage.au3> #include <ScreenCapture.au3> Example() Func Example() Local $listview, $button, $item1, $item2, $item3, $msg GUICreate("listview items", 220, 250, 100, 200, -1, $WS_EX_ACCEPTFILES) GUISetBkColor(0x00E0FFFF) ; will change background color $listview = GUICtrlCreateListView("col1 |col2|col3 ", 10, 10, 200, 150);,$LVS_SORTDESCENDING) $button = GUICtrlCreateButton("Value?", 75, 170, 70, 20) $item1 = GUICtrlCreateListViewItem("item2|col22|col23", $listview) $item2 = GUICtrlCreateListViewItem("item1|col12|col13", $listview) $item3 = GUICtrlCreateListViewItem("item3|col32|col33", $listview) GUICtrlCreateInput("", 20, 200, 150) GUICtrlSetState(-1, $GUI_DROPACCEPTED) ; to allow drag and dropping GUISetState() GUICtrlSetData($item2, "ITEM1") GUICtrlSetData($item3, "||COL33") GUICtrlDelete($item1) _Capture_Listview($listview, @ScriptDir & "\listview.jpg") Do $msg = GUIGetMsg() Select Case $msg = $button MsgBox(0, "listview item", GUICtrlRead(GUICtrlRead($listview)), 2) Case $msg = $listview MsgBox(0, "listview", "clicked=" & GUICtrlGetState($listview), 2) EndSelect Until $msg = $GUI_EVENT_CLOSE EndFunc ;==>Example Func _Capture_Listview($hWnd, $sFile) If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) If Not IsHWnd($hWnd) Then Return SetError(1) _GDIPlus_Startup() $iWidth = _WinAPI_GetWindowWidth($hWnd) $iHeight = _WinAPI_GetWindowHeight($hWnd) _WinCapture($hWnd, $sFile, $iWidth, $iHeight) _GDIPlus_Shutdown() EndFunc ;==>_Capture_Listview Func _WinCapture($hWnd, $sFile, $iWidth = -1, $iHeight = -1) Local $iH, $iW, $hDDC, $hCDC, $hBMP If $iWidth = -1 Then $iWidth = _WinAPI_GetWindowWidth($hWnd) If $iHeight = -1 Then $iHeight = _WinAPI_GetWindowHeight($hWnd) $hDDC = _WinAPI_GetDC($hWnd) $hCDC = _WinAPI_CreateCompatibleDC($hDDC) $hBMP = _WinAPI_CreateCompatibleBitmap($hDDC, $iWidth, $iHeight) _WinAPI_SelectObject($hCDC, $hBMP) _SendMessage($hWnd, 0x000F, $hCDC, 0) ; $WM_PAINT = 0x000F DllCall("User32.dll", "int", "PrintWindow", "hwnd", $hWnd, "hwnd", $hCDC, "int", 1) ; PW_CLIENTONLY = 1 Only the client area of the window is copied to hdcBlt. By default, the entire window is copied. #cs Local $WM_PAINT = 0x000F Local $WM_PRINT = 0x317 Local $PRF_CHILDREN = 0x10; Draw all visible child windows. Local $PRF_CLIENT = 0x4 ; Draw the window's client area. Local $PRF_OWNED = 0x20 ; Draw all owned windows. Local $PRF_NONCLIENT = 0x2 ; Draw the window's Title area. Local $PRF_ERASEBKGND = 0x8 ; Erases the background before drawing the window Local $Ret = _SendMessage($hWnd, $WM_PAINT, $hCDC, 0) $Ret = _SendMessage($hWnd, $WM_PRINT, $hCDC, BitOR($PRF_CHILDREN, $PRF_CLIENT, $PRF_OWNED, $PRF_NONCLIENT, $PRF_ERASEBKGND)) #ce _WinAPI_BitBlt($hCDC, 0, 0, $iW, $iH, $hDDC, 0, 0, 0x00330008) _WinAPI_ReleaseDC($hWnd, $hDDC) _WinAPI_DeleteDC($hCDC) _ScreenCapture_SaveImage($sFile, $hBMP, True) ; Return $hBMP EndFunc ;==>_WinCapture OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
l3ill Posted November 6, 2013 Share Posted November 6, 2013 @ Melba - is it possible to save the TV View as a JPG like Kafu's ? can be scrolled up and down as an image and save this image to a file ? My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 6, 2013 Moderators Share Posted November 6, 2013 billo,Saving the content of the list to a file is simple - just write the lines to a file as they are written to the list. Reading the list back in from the file is equally trivial. I have no idea how to get the list content into an image though. I imagine that you would need a GDI guru like UEZ using something liek _GDIPlus_GraphicsDrawString for that. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
l3ill Posted November 6, 2013 Share Posted November 6, 2013 I only ask because I think thats what OP was looking for... .....Long treeview as one long image... My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example 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