Sign in to follow this  
Followers 0
ACalcutt

Resizing a child window based on the parent window size

4 posts in this topic

#1 ·  Posted (edited)

Hello everyone,

I am working on my next version of vistumbler and I would like to get my child window to resize when i resize its parent window. right now i can chang it in the GUI...but i would like it to happen automatically.

This is an example gui of what i am talking about

#include <GUIConstants.au3>
Global Const $WS_EX_CONTROLPARENT = 0x00010000

$ParentGUI = GUICreate("AForm1", 613, 420,  -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
GUISetBkColor(0xB4B4B4)
$Label1 = GUICtrlCreateLabel("Parent Window", 8, 0, 77, 17)
GUICtrlSetBkColor(-1, 0xB4B4B4)
GUISetState(@SW_SHOW)


$ChildGUI = GUICreate("", 400, 200, 0, 30, BitOR($WS_CHILD, $WS_TABSTOP, $WS_SIZEBOX), $WS_EX_CONTROLPARENT, $ParentGUI)
$Label1 = GUICtrlCreateLabel("Child Window", 8, 0, 77, 17)
GUISetState(@SW_SHOW)

GUISwitch($ParentGUI)



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

    EndSwitch
WEnd

I would like to expand the child window based on the size of the parent window

Edited by ACalcutt

Andrew Calcutt

Http://www.Vistumbler.net

Http://www.TechIdiots.net

Its not an error, its a undocumented feature

Share this post


Link to post
Share on other sites



Maybe...

#include <GUIConstants.au3>
Global Const $WS_EX_CONTROLPARENT = 0x00010000

$ParentGUI = GUICreate("AForm1", 613, 420,  -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
GUISetBkColor(0xB4B4B4)
$Label1 = GUICtrlCreateLabel("Parent Window", 8, 0, 77, 17)
GUICtrlSetBkColor(-1, 0xB4B4B4)
GUISetState(@SW_SHOW)


$ChildGUI = GUICreate("", 400, 200, 0, 30, BitOR($WS_CHILD, $WS_TABSTOP, $WS_SIZEBOX), $WS_EX_CONTROLPARENT, $ParentGUI)
$Label1 = GUICtrlCreateLabel("Child Window", 8, 0, 77, 17)
GUISetState(@SW_SHOW)

GUISwitch($ParentGUI)



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

    EndSwitch
    
    $a = WinGetPos($ParentGUI)
    $b = WinGetPos($ChildGUI)
    
    If Round($b[2] / $a[2], 2) * 100 <> 65 Or Round($b[3] / $a[3], 2) * 100 <> 45 Then WinMove($ChildGUI, "", 0, 30, $a[2]*.65, $a[3]*.45) 

WEnd

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Cool thanks

Maybe...

#include <GUIConstants.au3>
Global Const $WS_EX_CONTROLPARENT = 0x00010000

$ParentGUI = GUICreate("AForm1", 613, 420,  -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
GUISetBkColor(0xB4B4B4)
$Label1 = GUICtrlCreateLabel("Parent Window", 8, 0, 77, 17)
GUICtrlSetBkColor(-1, 0xB4B4B4)
GUISetState(@SW_SHOW)
$ChildGUI = GUICreate("", 400, 200, 0, 30, BitOR($WS_CHILD, $WS_TABSTOP, $WS_SIZEBOX), $WS_EX_CONTROLPARENT, $ParentGUI)
$Label1 = GUICtrlCreateLabel("Child Window", 8, 0, 77, 17)
GUISetState(@SW_SHOW)

GUISwitch($ParentGUI)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
    
    $a = WinGetPos($ParentGUI)
    $b = WinGetPos($ChildGUI)
    
    If Round($b[2] / $a[2], 2) * 100 <> 65 Or Round($b[3] / $a[3], 2) * 100 <> 45 Then WinMove($ChildGUI, "", 0, 30, $a[2]*.65, $a[3]*.45) 

WEnd

8)


Andrew Calcutt

Http://www.Vistumbler.net

Http://www.TechIdiots.net

Its not an error, its a undocumented feature

Share this post


Link to post
Share on other sites

Welcome

8)


NEWHeader1.png

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