最近理解能力出了点问题。可能理解错了楼主的意思了。
看看这个代码可以吗?#include <array.au3>
#include <file.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Local $f, $shell, $s, $i
Local $path = @MyDocumentsDir & "\My Pictures"
Local $xfile = _FileListToArray($path, "*.jpg")
Local $file, $size
$Form1 = GUICreate("Form1", 639, 460, -1, -1, $WS_SIZEBOX + $WS_MINIMIZEBOX + $WS_MAXIMIZEBOX)
$jpg = GUICtrlCreatePic("", -1, -1, 639, 460)
GUISetState()
For $i = 1 To UBound($xfile) - 1
$file = $path & $xfile[$i]
getWH()
$size = StringSplit($s, "x")
$Width = $size[1]
$Height = StringStripWS($size[2], 1)
GUICtrlSetImage($jpg, $file)
If $Width > 639 Then
GUICtrlSetPos($jpg, 639 - $Width, -1, $Width, $Height)
If $Height > 460 Then GUICtrlSetPos($jpg, -1, 460 - $Height, $Width, $Height)
Else
GUICtrlSetPos($jpg, (639 - $Width) / 2, 0, $Width, $Height)
If $Height > 460 Then GUICtrlSetPos($jpg, 0, 460 - $Height, $Width, $Height)
EndIf
Sleep(2000)
Next
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func getWH()
$o = ObjCreate("scripting.filesystemobject")
$f = $o.GetFile($file)
$shell1 = ObjCreate("Shell.Application")
$shell = $shell1.Namespace($f.ParentFolder.Path)
$s = $shell.GetDetailsOf($shell.Items.Item($f.Name), 26)
EndFunc ;==>getWH
|