Lee Evans Posted August 24, 2005 Share Posted August 24, 2005 I wanted to create a small slideshow program and found a script on this forum that I began to modify for my purposes. But I having having a problem when the image used is larger or smaller than the original picture control size. If the image is larger then only a portion of the image is shown. If the image is smaller then the smaller image is shown over the top of the stretched image. It seems like the original image is being shown drawn over the stretched/shrunk image in the control. Is their any way around this? I am not using the beta but the last released version. Here is the code I have. I have tried recreating the picture control again but the same think seems to happens. expandcollapse popup#include <GUIConstants.au3> Local $console = GuiCreate("Pictures", 810, 640, 0, 0, $WS_SIZEBOX+$WS_SYSMENU) $n=GUICtrlCreatePic("C:\card1.bmp",0,0, 810, 640);Stretched to fit dialog GUISetState ();(@SW_SHOW, $console) ; will display an empty dialog box Local $file_list = "" Local $search = FileFindFirstFile("c:\*.bmp") ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop if $file_list = "" Then $file_list = $file Else $file_list = $file_list & "|" & $file Endif WEnd ; Close the search handle FileClose($search) Global $frame_list = StringSplit($file_list, "|") Global $frame_index = 1; while 1 = 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop if $msg = $n Then;click on picbox makes picture change AdvanceFrame() Endif WEnd Func AdvanceFrame() $frame_index = $frame_index + 1 if $frame_index >= UBound($frame_list) Then $frame_index = 1; Endif Local $img = $frame_list[$frame_index] WinSetTitle("Pictures", "", "Picture display - " & $img) ;GUICtrlDelete($n) ;$n=GUICtrlCreatePic("C:\"&$img,0,0, 810, 640);this recreates the pic control GUICtrlSetImage($n, "C:\"&$img);Sends new image resizes to fit but still shows original image size as well ;GUICtrlSetState (@SW_Hide,$n) ;GUICtrlSetState (@SW_SHOW,$n) Endfunc Exit Link to comment Share on other sites More sharing options...
GaryFrost Posted August 24, 2005 Share Posted August 24, 2005 (edited) expandcollapse popup#include <GUIConstants.au3> Local $console = GUICreate("Pictures", 810, 640, 0, 0, $WS_SIZEBOX + $WS_SYSMENU) $n = GUICtrlCreatePic("C:\card1.bmp", 0, 0, 810, 640);Stretched to fit dialog GUISetState();(@SW_SHOW, $console) ; will display an empty dialog box Local $file_list = "" Local $search = FileFindFirstFile("c:\*.bmp") ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop If $file_list = "" Then $file_list = $file Else $file_list = $file_list & "|" & $file EndIf WEnd ; Close the search handle FileClose($search) Global $frame_list = StringSplit($file_list, "|") Global $frame_index = 1; While 1 = 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $n Then;click on picbox makes picture change AdvanceFrame($n) EndIf WEnd Func AdvanceFrame(ByRef $n) $frame_index = $frame_index + 1 If $frame_index >= UBound($frame_list) Then $frame_index = 1; EndIf Local $img = $frame_list[$frame_index] WinSetTitle("Picture", "", "Picture display - " & $img) GUICtrlDelete($n) $n = GUICtrlCreatePic("C:\" & $img, 0, 0, 810, 640);this recreates the pic control ;GUICtrlSetImage($n, "C:\"&$img);Sends new image resizes to fit but still shows original image size as well ;GUICtrlSetState (@SW_Hide,$n) ;GUICtrlSetState (@SW_SHOW,$n) EndFunc ;==>AdvanceFrame Exit Doesn't work correctly in the release version, but it does in the latest beta. Edited August 24, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. 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