Jump to content

A very small Gui Script


ludo10
 Share

Recommended Posts

Hello,

as many others, i am new in GUI scripts.

I have to script an easy thing : View a JPG and a OK button to close the GUI windows, with no title bar if possible, and no icon task

Actually, i used this script. If someone could help me to finish it :D

Bests regards

#include <GUIConstants.au3>

GUICreate("My GUI picture",350,300,-1,-1,$WS_SIZEBOX+$WS_SYSMENU) ; will create a dialog box that when displayed is centered

GUISetBkColor (0xE0FFFF)

$n=GUICtrlCreatePic("D:\temp\jpg\toto.jpg",50,50, 250,250)

GUISetState ()

; Run the GUI until the dialog is closed

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Wend

GUISetState ()

; resize the control

$n=GUICtrlSetPos($n,50,50,200,100)

; Run the GUI until the dialog is closed

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Wend

Link to comment
Share on other sites

Hello,

as many others, i am new in GUI scripts.

I have to script an easy thing : View a JPG and a OK button to close the GUI windows, with no title bar if possible, and no icon task

Actually, i used this script. If someone could help me to finish it :D

Bests regards

Well, I Really have no idea what you are trying to do, but here's a stab at something that might get you started:

#include <GUIConstants.au3>
GUICreate("My GUI picture",350,275,-1,-1,$WS_POPUP)
GUISetBkColor (0xE0FFFF)
$n=GUICtrlCreatePic("D:\temp\jpg\toto.jpg",0,0,250,250)
$b=GuiCtrlCreateButton("Close", 150, 250, 50, 25) 
GUISetState ()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $b
            ExitLoop
    EndSelect
Wend
Exit

1) The $WS_POPUP style is used to make a window without a title bar.

2) You will have to change the GUICtrlCreatePic function so that the parameters match your image.

3) And if the user clicks the button "Close", I have the windows close. I believe this is what you requested.

I hope this helps. :D For further help, try consulting the helpfile. If your native language is not english, I believe there are translations of the file available.

Link to comment
Share on other sites

o and by the way the hole consult the help file :D he copied that right out of it ehhee

#include <GUIConstants.au3>
$GUI = GUICreate("Pic Chooser", 622, 320, 192, 125)
$choose = GUICtrlCreateButton("Choose a Pic", 176, 288, 73, 25)
$quit = GUICtrlCreateButton("Exit", 344, 288, 81, 25)
$pic = GUICtrlCreatePic(@Systemdir & "\oobe\images\mslogo.jpg", 144, 8, 305, 273)
GUICtrlSetState(-1,$GUI_DISABLE)
GUISetState()
While 1
    $msg = GuiGetMsg()
Select
    Case $msg = $choose
        GUICtrlDelete($pic)
        $pic = GUICtrlCreatePic(FileOpenDialog("Choose a Picture","","Jpegs (*.jpg;*.jpeg)"), 144, 8, 305, 273)
        GUICtrlSetState(-1,$GUI_DISABLE)
    Case $msg = $quit or $msg = $GUI_EVENT_CLOSE
        Exit
EndSelect
WEnd
Edited by thatsgreat2345
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...