Alle Bilder in nen Ordner und du kannst die mit
Code:
Func _LoadFiles($sDir)
$get = _FileListToArray($sDir,"*",1)
Local $array[$get[0]+1]
$array[0] = $get[0]
For $i = 1 To $get[0]
$array[$i] = $get[$i]
Next
Return $array
EndFunc
auslesen.
Ich bin gerade an nem anderen Tool, aber die Funktion könnte ganz nützlich sein:
Code:
Func _SetImageSize($sImage,$sMaxW,$sMaxH)
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile($sImage)
$w = _GDIPlus_ImageGetWidth($hImage)
$h = _GDIPlus_ImageGetHeight($hImage)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()
If $w > $h Then
$new_w = $sMaxW
$new_h = $new_w / ( $w / $h )
Else
$new_h = $sMaxH
$new_w = $new_h * ( $w / $h )
EndIf
Local $array[2] = [$new_w,$new_h]
Return $array
EndFunc
EDIT:
Tadelüüü~ Da hast du:
Code:
#include <Array.au3>
#include <File.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
;-----------------------------Start Up--------------
$loadFile = _LoadFiles(@ScriptDir & "\pictures") ;pfad eventuell abändern
_ArrayDisplay($loadFile)
Global $ImageArray[$loadFile[0]+1][2]
$ImageArray[0][0] = $loadFile[0]
For $i = 1 To $loadFile[0]
$setImage = _SetImageSize(@ScriptDir & "\pictures\"&$loadFile[$i],600,600) ;Pfad und Dimensionen eventuell abändern
$ImageArray[$i][0] = $setImage[0]
$ImageArray[$i][1] = $setImage[1]
Next
_ArrayDisplay($ImageArray)
;------------------------------GUI--------------------
$gui = GUICreate("", 600, 650) ;Dimensionen eventuell abändern
$Pic = GUICtrlCreatePic("",0,0,600,600)
$Button_n = GUICtrlCreateButton("Next", 440, 616, 123, 25)
$Button_p = GUICtrlCreateButton("Previous", 32, 616, 123, 25)
GUICtrlSetState(-1,$GUI_DISABLE)
GUISetState(@sw_show)
;-----------------------------Viewing--------------------
$n = 1
GUICtrlSetImage($Pic,@ScriptDir & "\pictures\"&$loadFile[$n]) ;pfad eventuell abändern
GUICtrlSetPos($Pic,0,0,$ImageArray[$n][0],$ImageArray[$n][1])
While 1
Switch GUIGetMsg()
Case -3
Exit
Case $Button_n
$n += 1
If $n > 1 Then GUICtrlSetState($Button_p,$GUI_ENABLE)
If $n = $ImageArray[0][0] Then GUICtrlSetState($Button_n,$GUI_DISABLE)
GUICtrlSetImage($Pic,@ScriptDir & "\pictures\"&$loadFile[$n]) ;pfad eventuell abändern
GUICtrlSetPos($Pic,0,0,$ImageArray[$n][0],$ImageArray[$n][1])
Case $Button_p
$n -= 1
If $n = 1 Then GUICtrlSetState($Button_p,$GUI_DISABLE)
If $n < $ImageArray[0][0] Then GUICtrlSetState($Button_n,$GUI_ENABLE)
GUICtrlSetImage($Pic,@ScriptDir & "\pictures\"&$loadFile[$n]) ;pfad eventuell abändern
GUICtrlSetPos($Pic,0,0,$ImageArray[$n][0],$ImageArray[$n][1])
Case $Pic
MsgBox(0,"","Clicked ;D")
EndSwitch
WEnd
;--------------------------Functions--------------------
Func _LoadFiles($sDir)
$get = _FileListToArray($sDir,"*",1)
Local $array[$get[0]+1]
$array[0] = $get[0]
For $i = 1 To $get[0]
$array[$i] = $get[$i]
Next
Return $array
EndFunc
Func _SetImageSize($sImage,$sMaxW,$sMaxH)
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile($sImage)
$w = _GDIPlus_ImageGetWidth($hImage)
$h = _GDIPlus_ImageGetHeight($hImage)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()
If $w > $h Then
$new_w = $sMaxW
$new_h = $new_w / ( $w / $h )
Else
$new_h = $sMaxH
$new_w = $new_h * ( $w / $h )
EndIf
Local $array[2] = [$new_w,$new_h]
Return $array
EndFunc
Ich hab's jetzt mit einfachem Anklicken gemacht, und die GUI bzw. maximale Bildergröße müsstest du auch noch definieren. Bei _FileListToArray kannst du dir mit WildCards auch direkt die Dateiendungen abfragen... nich mein Ding :x
EDIT No2:
Label:
Die Dateinamen müsssen einfach nur mit den Stylenamen übereinstimmen (Endungenentfernen nich vergessen):
Code:
;-----------------------------Start Up--------------
Global $LabelArray[$loadFile[0]+1]
$LabelArray[0] = $loadFile[0]
For $i = 1 To $loadFile[0]
$setImage = _SetImageSize(@ScriptDir & "\pictures\"&$loadFile[$i],600,600) ;Pfad und Dimensionen eventuell abändern
$ImageArray[$i][0] = $setImage[0]
$ImageArray[$i][1] = $setImage[1]
$string = StringSplit($loadFile[$i],".")
$LabelArray[$i] = $string[1]
Next
;------------------------------GUI--------------------
$Label = GUICtrlCreateLabel("",200,616,100,15)
;-----------------------------Viewing--------------------
GUICtrlSetData($Label,$LabelArray[$n])