Jump to content

Grow UDF


cembry90
 Share

Recommended Posts

Heh.. This is just a simple UDF that makes a given GUI grow from its current size to a size you specify.

There are 2 different ways to make it grow in size:

• Method 1 : Horizontally then vertically; or

• Method 2 : Both ways at once.

See Code Below.

Chris

#include-once

Func grow($gui, $guix, $guiy, $type, $step)
    $size = WinGetClientSize($gui)
    If $type = 1 Then
        For $x = $size[0] To $guix Step $step/3
            $size = WinGetClientSize($gui)
            $zx = (@DesktopWidth/2) - ($size[0]/2)
            $zy = (@DesktopHeight/2) - ($size[1]/2)
            WinMove($gui, '', $zx, $zy, $x + $step, 25)
        Next
        For $y = $size[1] To $guiy Step $step/2
            $size = WinGetClientSize($gui)
            $zx = (@DesktopWidth/2) - ($size[0]/2)
            $zy = (@DesktopHeight/2) - ($size[1]/2)
            WinMove($gui, '', $zx, $zy, $x, $y + $step)
        Next
    ElseIf $type = 2 Then
        For $w = 0 To 102 Step $step/4
            $size = WinGetClientSize($gui)
            $dw = (@DesktopWidth/2) - ($size[0]/2)
            $dh = (@DesktopHeight/2) - ($size[1]/2)
            WinMove($gui, '', $dw, $dh, ($guix/100)*$w, ($guiy/100)*$w)
        Next
    EndIf
EndFunc

Usage:

grow(handle, width, height, method, speed)

Sample script:

#include <GuiConstants.au3>
#include 'grow.au3'

$gui = GUICreate('Sample Growth', 20, 10)
GUISetState()

grow($gui, 400, 200, 1, 5)

$label = GUICtrlCreateLabel('Nice!', 100, 25, 200, 100)
GUICtrlSetFont($label, 75)

While GUIGetMsg($gui) <> $GUI_Event_Close
    Sleep(10)
WEnd

AutoIt Stuff:

 

UDFs: {Grow}

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