Jump to content

GUICtrlCreatePic & GUICtrlSetPic


Recommended Posts

Hi,

i'm using a script with a pic as background created by GUICtrlCreatePic and it his working fine, but later, i want to change the image with GUICtrlSetPic! The pic is shown, but it isn't resized...(showing a part of the pic and not the whole small thing...) What did i wrong?

here is my code

Dim $dir = "D:\Docs\Pics\2005\02.01.2005"
$search = FileFindFirstFile($dir & "\*.jpg")
$piclist = FileOpen (@TempDir & "\pic.txt",2)    
$i = 0
While 1
    $file = FileFindNextFile($search)
    If @error Then ExitLoop
    FileWriteLine ($piclist,$dir & "\" & $file)
    If $file = "." Then $i =$i-1
    If $file = ".." Then $i =$i-1        
    If @error Then ExitLoop
    $i=$i+1    
WEnd
FileClose ($piclist)

$piclist = FileOpen (@TempDir & "\pic.txt",0) 
   
#include <GuiConstants.au3>
GuiCreate("SlideShow", 666, 525,-1,-1,$WS_SYSMENU)
$pic = GuiCtrlCreatePic(FileReadLine ($piclist), 10, 10,640,480)
GuiSetState()
Slide()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend
Exit
Func Slide ()
    $m = 1
    Do
    GUICtrlSetimage($pic,FileReadLine ($piclist,$m))
    $m = $m + 1
    Sleep (1000)
    Until $i = $m
    Slide ()
EndFunc

thanks a lot

Edited by Cyclops

Sorry for my cruel english :D

Link to comment
Share on other sites

Sorry, wrong code and wrong topic title!

The code is now correct. After creating the pic with >> GuiCtrlCreatePic(FileReadLine ($piclist), 10, 10,640,480)<< i want to change the pic with >>GUICtrlSetimage($pic,FileReadLine ($piclist,$m))<<! It's working, but there is only a part of the pic shown...

Sorry for my cruel english :D

Link to comment
Share on other sites

Sorry, wrong code and wrong topic title!

The code is now correct. After creating the pic with >> GuiCtrlCreatePic(FileReadLine ($piclist), 10, 10,640,480)<< i want to change the pic with >>GUICtrlSetimage($pic,FileReadLine ($piclist,$m))<<! It's working, but there is only a part of the pic shown...

<{POST_SNAPBACK}>

You need to have enough room to display your picture the size is defined by the GuiCtrlCreatePic :(
Link to comment
Share on other sites

you mean that the pics size is to big, or that the pic area created by GuiCtrlCreatePic is to small?

I worked on the script and here is it again, but i have still the problem....

Dim $dir = "D:\Docs\Pics\2005\02.01.2005"
$search = FileFindFirstFile($dir & "\*.jpg")
$piclist = FileOpen (@TempDir & "\pic.txt",2)   
$i = 0
While 1
    $file = FileFindNextFile($search)
    If @error Then ExitLoop
    FileWriteLine ($piclist,$dir & "\" & $file)
    If $file = "." Then $i =$i-1
    If $file = ".." Then $i =$i-1       
    If @error Then ExitLoop
    $i=$i+1 
WEnd
FileClose ($piclist)
$piclist = FileOpen (@TempDir & "\pic.txt",0)   
#include <GuiConstants.au3>
If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000
GuiCreate("SlideShow", 1024, 768,-1,-1,$WS_POPUPWINDOW)
$pic = GuiCtrlCreatePic(FileReadLine ($piclist), 0, 0,1024,768)
GuiSetState()
Slide()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend
Exit
Func Slide ()
    $m = 1
    Do
    GUICtrlSetimage($pic,FileReadLine ($piclist,$m))
    GUISetState (@SW_Hide,$pic)
    GUISetState (@SW_SHOW,$pic) 
    $m = $m + 1
    Until $i = $m
    Slide ()
EndFunc

When i delete this lines

GUISetState (@SW_Hide,$pic)
    GUISetState (@SW_SHOW,$pic)
The pic isn't shownright.... :( Edited by Cyclops

Sorry for my cruel english :D

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...