Jump to content

Problem building multi thumbnail display screen


byarotsky
 Share

Recommended Posts

I am attempting to build a script that will pull jpg files from my external device, copy local, resize and change orientation and move to the server is serveral places. Part of the script I would like to have a preview screen to check off the files that I want to process. I have taken some examples and tried to manipulate to do what I want, but I am struggling to get my list of images to show properly.

Basically in this test I would like to read list of files from folder

Generate a screen with thumbnails and a corresponding checkbox

Each thumbnail will show a different file in the folder

Currently I am only able to show either the last image in the first location and the rest are blank or all images are the same picture. Also I haven't even tried getting more than one line of images (fill the screen).

Any help would be greatly appreciated.

Thanks

Brad

#include <GDIPlus.au3>
#include <Array.au3>
#include <File.au3>
Global $ImgPath = "C:Documents and SettingsOwnerDesktopTest2"
Local $hGui, $iPic, $hGraphic, $hBitmap, $hImage

$hGui = GUICreate("", @DesktopWidth, @DesktopHeight)
$iPic = GUICtrlCreatePic("", 0, 25, @DesktopWidth, 25)
$ImgHeight = 133
$ImgWidth = 133
$ImgSpacing = 10

Local $localfile = _FileListToArray($ImgPath, "*.jpg", 1) ; List all jpg files in last folder
_ArrayDelete($localfile, 0)
_ArraySort($localfile)
;_ArrayDisplay($localfile)

_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics(@DesktopWidth, $ImgHeight, $hGraphic)
_GDIPlus_GraphicsDispose($hGraphic)
$hGraphic = _GDIPlus_ImageGetGraphicsContext ($hBitmap)
While UBound($localfile)
$PopFileName = _ArrayPop($localfile)
For $i = 0 To @DesktopWidth - $ImgWidth Step $ImgWidth + $ImgSpacing
$hImage = _GDIPlus_ImageLoadFromFile ($ImgPath & $PopFileName)
_GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, $i + $ImgSpacing , 0, $ImgWidth, $ImgHeight)
GUICtrlCreateCheckbox($PopFileName, $i + $ImgSpacing , $ImgHeight + 25, 120, 20)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_ImageDispose($hImage)
Next
WEnd

$hImage = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
_GDIPlus_BitmapDispose($hBitmap)
_WinAPI_DeleteObject(GUICtrlSendMsg($iPic, 0x0172, 0, $hImage))
_GDIPlus_ShutDown()

GUISetState(@SW_SHOW, $hGui)

While GUIGetMsg() <> -3
WEnd
Edited by byarotsky
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...