Jump to content
Sign in to follow this  

GUICtrlCreatePic change size

Recommended Posts


How can i change the pic controls size? In the script below I use fileopen to display a pic.

The first time around it opens the file and displays it, but i want to change the pic controls width and height to match the photos each time a new photo is selected.

#include <GUIConstants.au3>

$Form1 = GUICreate("AForm1", 633, 454, 193, 115,$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPCHILDREN )
Dim $filemenu = GUICtrlCreateMenu ("&File")
Dim $fileitem = GUICtrlCreateMenuitem ("Open",$filemenu)
$Obj1_ctrl = GUICtrlCreatePic("",120, 32,$Width1,$Height1)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        Case $fileitem
            $file = FileOpenDialog("Choose file...",@ScriptDir,"Picture Files (*.*)")
            If @error <> 1 Then pic_Open($file)

Func pic_Open($file)
    GUICtrlSetImage ($Obj1_ctrl, $file)

Share this post

Link to post
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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.