Jump to content



Photo

Display a list of images (As in an album)

Album images image list listview

  • Please log in to reply
2 replies to this topic

#1 nikitanova

nikitanova

    Seeker

  • Active Members
  • 18 posts

Posted 10 June 2012 - 03:26 PM

Hello friends

I have a question regarding displaying a list of images.

What I want is to display a list of image thumbnails in a photo gallery/album. I have used listview control to display icons with texts. I want the same thing here. But just one little difference. I want the icons to be "bigger" (and not just icons).

When the user clicks on an image, a new window opens with the full view of the image. (The same thing that windows explorer does).

If I am still unable to explain it properly, then, all I want is to make something like the FaceBook photo album.

I know how to display a single image etc..
I wrote code to generate thumbnails.

I just need help displaying the list of images (as images, not text) in a listview. (A custom listview or some other control will be fine too). I have only ~40 images to show, so performance is not an issue.

Thanks a lot in advance

Nikita Nova







#2 JLogan3o13

JLogan3o13

    Back to 600!

  • MVPs
  • 2,198 posts

Posted 11 June 2012 - 01:59 PM

Hi, nikitanova. Rather than a listview, why not use GUICtrlCreatePic? You can then set the action for each thumbnail to be opening the picture in the default viewer. Something like this should give you what you want:

Plain Text         
#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Local $msg GUICreate("My Pics") GUISetState(@SW_SHOW)      $pic1 = GUICtrlCreatePic(@ScriptDir & "1.jpg", 10, 10, 75, 75)    $pic2 = GUICtrlCreatePic(@ScriptDir & "2.jpg", 95, 10, 75, 75)    While 1         $msg = GUIGetMsg()            Select               Case $msg = $GUI_EVENT_CLOSE                  ExitLoop               Case $msg = $pic1                  ShellExecute(@ScriptDir & "1.jpg")               Case $msg = $pic2                  ShellExecute(@ScriptDir & "2.jpg")            EndSelect     WEnd GUIDelete()

J.I spent 10 minutes reviewing code and thinking "What kind of drugs is this guy on?" before realizing it was something I wrote.My Scripts:Include Source with Compiled Script, Disk Maintenance for Windows XP, "Deal-A-Day" Sites, SCCM 2007 Front End, Windows Firewall UDF

#3 lark

lark

    Seeker

  • Active Members
  • 47 posts

Posted 11 June 2012 - 03:13 PM

Since you have ~40 pictures, it might be easier to loop through all the pictures. This creates all the pictures in the same position on the gui, and hides all but one of the pictures. There are 2 buttons for you to set which picture you are viewing:

AutoIt         
#include <Array.au3> #include <GUIConstantsEx.au3> Global $hForm = GUICreate("Pictures", 280, 200) Global $iPicCount = 40; Global $avHPics[$iPicCount] For $i = 1 To $iPicCount $avHPics[$i-1] = GUICtrlCreatePic(@ScriptDir & "pic" & $i & ".png", 100, 50, 100, 100) GUICtrlSetState(-1, $GUI_HIDE) Next Global $hButtonLeft = GUICtrlCreateButton("<-----", 20, 50, 60, 25) Global $hButtonRight = GUICtrlCreateButton("----->", 220, 50, 60, 25) Global $iCurrentPic = 1; 1-based index of the currently shown picture GUICtrlSetState($avHPics[0], $GUI_SHOW) GUISetState() Global $msg While 1 $msg = GUIGetMsg() Switch $msg   Case -3    Exit   Case $avHPics[0] To $avHPics[$iPicCount-1]    ShellExecute(@ScriptDir & "pic" & $avHPics[_ArraySearch($avHPics, $msg) + 1] & ".png")   Case $hButtonLeft    GUICtrlSetState($avHPics[$iCurrentPic-1], $GUI_HIDE)    $iCurrentPic -= 1    If $iCurrentPic < 1 Then $iCurrentPic = $iPicCount    GUICtrlSetState($avHPics[$iCurrentPic-1], $GUI_SHOW)   Case $hButtonRight    GUICtrlSetState($avHPics[$iCurrentPic-1], $GUI_HIDE)    $iCurrentPic += 1    If $iCurrentPic > $iPicCount Then $iCurrentPic = 1    GUICtrlSetState($avHPics[$iCurrentPic-1], $GUI_SHOW) EndSwitch WEnd






Also tagged with one or more of these keywords: Album, images, image, list, listview

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users