Jump to content

GUICtrlCreatePic change size


Will66
 Share

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