Sign in to follow this  
Followers 0
Will66

GUICtrlCreatePic change size

2 posts in this topic

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)
    $Height1=100
$Width1=100
$Obj1_ctrl = GUICtrlCreatePic("",120, 32,$Width1,$Height1)
$Width=50
$Height=50
GUISetState(@SW_SHOW)

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

Func pic_Open($file)
    GUICtrlSetImage ($Obj1_ctrl, $file)
    MsgBox(0,"",$file)
;$Obj1_ctrl=GUICtrlSetPos($Obj1_ctrl,120,32,200,200)
    EndFunc

Share this post


Link to post
Share on other sites



This might work: GUICtrlSetResizing()

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  
Followers 0