Jump to content

gui and cuictrlcreatepic


 Share

Recommended Posts

i have a gui with a picture in it.

is it possible that i can drag the size of my gui that i can make it wider or taler?

and if i do that the picture streth so the picture if getting bigger and smaller to.

but teh ratio need to be correct. so if i make it very wide but not so tall a emty gui part is coming to exsist and the ratio of the picture is still correct?

this is my code now

#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=imageres.dll_I0058_0409.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
OnAutoItExitRegister("whenexit")
if WinExists("Aanwezigheidsbord") Then
    MsgBox(16, "Error", "Het Aanwezigheidsbord is al geopend.")
    exit
    endif
$x = RegRead("HKEY_CURRENT_USER\Software\VBV", "X position")
$y = RegRead("HKEY_CURRENT_USER\Software\VBV", "Y position")
if @error Then
    GUICreate("Aanwezigheidsbord",647,580)
Else
    GUICreate("Aanwezigheidsbord",647,580,$x,$y)
EndIf
    GUISetState(@SW_SHOW)
    do
    $n = GUICtrlCreatePic("something.jpg",0, 0, 647, 584)
    until $n <>0
While 1
$msg = GUIGetMsg()
if $msg = $GUI_EVENT_CLOSE Then Exit
if @sec = 10 then GUICtrlSetImage($n, "something.jpg")
if @sec = 25 then GUICtrlSetImage($n, "something.jpg")
if @sec = 40 then GUICtrlSetImage($n, "something.jpg")
if @sec = 55 then GUICtrlSetImage($n, "something.jpg")
WEnd
Func whenexit()
$size = WinGetPos("[active]")
RegWrite("HKEY_CURRENT_USER\Software\VBV", "X position", "REG_SZ", $size[0])
RegWrite("HKEY_CURRENT_USER\Software\VBV", "Y position", "REG_SZ", $size[1])
GUIDelete()
EndFunc
Link to comment
Share on other sites

Try this for resizing with the GUI:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Local $hGUI = GUICreate("GUI", 600, 400, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP), $WS_EX_LAYERED)
Local $hImage = GUICtrlCreatePic(@ScriptDir & "\image.jpg", 0, 0, 600, 400)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
Link to comment
Share on other sites

Try this for resizing with the GUI:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Local $hGUI = GUICreate("GUI", 600, 400, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP), $WS_EX_LAYERED)
Local $hImage = GUICtrlCreatePic(@ScriptDir & "\image.jpg", 0, 0, 600, 400)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

i have tested but it wont work.

i can screw the ratio if i want.

the ratio is just not right.

Link to comment
Share on other sites

The script was for:

i have a gui with a picture in it.

is it possible that i can drag the size of my gui that i can make it wider or taler?

and if i do that the picture streth so the picture if getting bigger and smaller to.

To keep the ratio of the picture, play with $DOCK* styles.

Link to comment
Share on other sites

The script was for:

To keep the ratio of the picture, play with $DOCK* styles.

i know i'm already trying that but it wont work when i open the gui it opens at 647,580

then the view is perfect but when i make it bigger or slimmer

this is what i dont want(see the image)

http://yfrog.com/n6autoitj

i want that it keeps it ratio.

and calculate what the new size should be when i make the gui bigger.

Edited by yucatan
Link to comment
Share on other sites

You have to make a function for keeping the ratio of the picture.

Center image in the gui, get the initial gui/picture width/height, calculate the ratio and when gui's dimensions change... and so on.

Link to comment
Share on other sites

You have to make a function for keeping the ratio of the picture.

Center image in the gui, get the initial gui/picture width/height, calculate the ratio and when gui's dimensions change... and so on.

i understand what i want has to be manualy made.

i understand what to do now.

the only thing that i cant figure out is wich and how the calculation must be.

the weith and heith u know. may i can help me a little bit.

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