Sign in to follow this  
Followers 0
emoyasha

shapes resizing

3 posts in this topic

i want to know how to make a shape usign autoit that looks liek this:

post-31056-1221079751_thumb.png

also how do i make a gui resize and all its controls stay in place and resize with it

for example i have a pic in the middle of a gui i want the pic to stay in its location but move with the gui

but i want the input boxes(only width wise) shapes and everything else to resize wit the gui


Admin Of:http://notmyspace.info [Under Development, looking for volunteers to help improve]http://PSNetCards.co.ukhttp://ZacnAndLindsey.com [Under development, not quite sure what to do with it yet]http://revelm.com------------------------------------Radio Streams:http://75.185.53.88:8000 [128kb/s 44kHz]http://75.185.53.88:8002 [22kb/s 22kHz](works on mobile phones)-----------------------------------My Server:Owned By: http://jumpline.comIP:66.84.19.220Bandwidth:200GBStorage Space:1TBNetwork Connection: 1GB/S[up and down]Operating System: Red Hat LinuxInstalled Apps:Webmail, phpBB, Majordomo, phpMyAdmin, MySQL, Active Server Pages, FrontPage Extensions 2002, GraphicsMagick, Mod Perl, Perl, PHP: Hypertext Preprocessor, Python(want cheap good webhosting, or need a place to park your domain? contact me)-----------------------------------

Share this post


Link to post
Share on other sites

i want to know how to make a shape usign autoit that looks liek this:

post-31056-1221079751_thumb.png

also how do i make a gui resize and all its controls stay in place and resize with it

for example i have a pic in the middle of a gui i want the pic to stay in its location but move with the gui

but i want the input boxes(only width wise) shapes and everything else to resize wit the gui

Best to use some graphics application to make the shape.

See GuiCtrlSetResizing. Just about any option you want can be achieved. Controls can stay in the middle, stay to the left or the right, grow with the gui and so on. Each control can be set differently. There is an example of using $GUI_DOCKAUTO here. (The fonts are not changed by the resizing option, that was added by code in the script.)


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

ok i tryed that but 1) the background shape does not resize with the window and when i try to keep the two pictures centered (using guisetresizingmode(-1, 768)they barley move with the windows staying to the left and become off center and the top goes over the right side of the other pic below it.

also the windows media com object bareley moves at all as well

here is my code

;-----------------
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>
#include <inet.au3>
#include <string.au3>
#include <Constants.au3>
#include <Array.au3>
#include <Color.au3>
#include <GDIPlus.au3>
#include <Misc.au3>
;------------------

;------------------
$GUIWidth = 320
$guiheight = 698
$red = 0
$green = 100
$blue = 225
Global $iColor[2] = ["0xFFFF00","0x0000FF"], $Label[2], $Button[2]
Global $Direction = 0
;------------------

;------------------
opt("GUIResizeMode",$GUI_DOCKAUTO)
Opt("TrayMenuMode", 1) 
Opt("TrayOnEventMode", 1)
Opt("GUIEventOptions", 1)
Opt("GUICloseOnESC", 1)
TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE, "show")
;-------------------

;-------------------
SplashImageOn("verified","verified.gif", 285, 70)
;-------------------

;--------------------
$site = "http://notmyspace.info"
$picloc = IniRead("data.dll", "prof", "pic", "")
$usern = IniRead("data.dll", "prof", "login", "UserName")
$passw = IniRead("data.dll", "prof", "pass", "")
$version = IniRead("data.dll", "system", "version", "0.0.1.2")
$welcome = IniRead("data.dll", "system", "message", "YourSpace Messenger")
$pass2 = _StringEncrypt(0, $passw, "yourspace")
;--------------------

;--------------------
TrayCreateItem("Show")
TrayItemSetOnEvent(-1, "show")
TrayCreateItem("")
TrayCreateItem("Exit")
TrayItemSetOnEvent(-1, "Terminate")
TraySetToolTip("YourSpace Messenger "&$Version)
TraySetClick(16)
;--------------------

;--------------------
$ads = _INetGetSource($site&"/messenger/ads.ym")
$adaray = stringsplit($ads, "|")
$countx = UBound($adaray)
$county = Random(1, $countx)
;--------------------
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("YourSpace Messenger", $GUIWidth, $GUIHeight, 277, 174,BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX))
GUISetCursor (3)
GUISetBkColor(0x00FFFF)
$Button3 = GUICtrlCreateButton("V", 300, 20, 20, 25, $BS_FLAT)
$Graphic = GUICtrlCreateGraphic (0,0, $GUIWidth, $GUIHeight)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)
;=============
GradientFill($Graphic, 0, 0, $GUIWidth, $GUIHeight, _ArrayCreate($blue,$green,$red), _ArrayCreate(255,255,255)); 
GUICtrlSetGraphic($Graphic,$GUI_GR_REFRESH)
;=============
$Input1 = GUICtrlCreateInput($usern , 58, 294, 209, 21)
$Input2 = GUICtrlCreateInput($pass2 , 58, 320, 209, 21, $ES_PASSWORD)
$Pic2 = GUICtrlCreatePic("frame.gif", 50, 24, 220, 204 )
$Pic3 = GUICtrlCreatePic($picloc, 58, 35, 204, 180)
$Button1 = GUICtrlCreateButton("Sign In", 122, 350, 75, 25, $BS_DEFPUSHBUTTON )
$adr = $adaray[$county]
$wmp = _wmpcreate(1, 10, 510, 300, 180);creates object
GUICtrlSetState($wmp, $GUI_DISABLE)
_wmpvalue( $wmp, "nocontrols" );hides controls
_wmploadmedia( $wmp, $adr);loads media
; -----------------
    $File = GUICtrlCreateMenu("&File")
    $LogOff = GUICtrlCreateMenuItem("Log Off", $File)
    $Info = GUICtrlCreateMenuItem("Info", $File)
    $com = GUICtrlCreateMenuItem("Commands", $File)
    $form = GUICtrlCreateMenuItem("formating tags", $File)
    $sets = GUICtrlCreateMenuItem("change text to speech settings", $File)
    GUICtrlCreateMenuItem("", $File)
    $Exit = GUICtrlCreateMenuItem("Exit", $File)
    
    $ContactsMenu = GUICtrlCreateMenu("&Contacts")
    $AddContact = GUICtrlCreateMenuItem("Add a contact", $ContactsMenu)
    $DelContact = GUICtrlCreateMenuItem("Delete a contact", $ContactsMenu)
    GUICtrlCreateMenuItem("", $ContactsMenu)
    $Import = GUICtrlCreateMenuItem("Import contacts from file", $ContactsMenu)
    $Export = GUICtrlCreateMenuItem("Export contacts to file", $ContactsMenu)
    For $x = $LogOff To $Export
        GUICtrlSetState($x, $GUI_DISABLE)
    Next
    GUICtrlSetState($Exit, $GUI_ENABLE)
    GUICtrlSetState($ContactsMenu, $GUI_ENABLE)
;--------------------

SplashOff()
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;------------------------
TextEffect($welcome, 0, 0, 17, 17, 1, 1, 0x00ff00, 0xff0000, 25, 25, 1, 1)
;------------------------

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Exit
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Form1, "int", 200, "long", 0x00090000)
        Exit
        CASE $Button3
        $Clr = _ChooseColor(2, 0, 2, $Form1)
$blue = _ColorGetBlue($clr)
$green = _ColorGetGreen($clr)
$red = _ColorGetRed($clr)
GradientFill($Graphic, 0, 0, $GUIWidth, $GUIHeight, _ArrayCreate($blue,$green,$red), _ArrayCreate(255,255,255)); 
GUICtrlSetGraphic($Graphic,$GUI_GR_REFRESH)
GUICtrlSetBkColor($Button3, $Clr)

        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            ;------------------
            GUICtrlSetState($Input1, $GUI_DISABLE)
            GUICtrlSetState($Input2, $GUI_DISABLE)
            GUICtrlSetState($Button1, $GUI_DISABLE)
            ;------------------
            
            ;------------------
            $pass = _MD5(GUICtrlRead($input2))
            ;------------------
            
                        $login = _INetGetSource($site&"/messenger/check2.php?login="&GUICtrlRead($Input1)&"&pass="&$pass)
            $login = StringSplit($login,"\")
            
            

            if $login[1] = "YES" Then
                TraySetIcon("show.ico")
                $picdl = StringSplit($login[2],".")
                            inetget($login[2], "pic."&$picdl[3])
            IniWrite("data.dll","prof","pic","pic."&$picdl[3])
            IniWrite("data.dll","prof","login",GUICtrlRead($Input1))
            IniWrite("data.dll","prof","pass",_StringEncrypt(1, GUICtrlRead($Input2), "yourspace"))
            SoundPlay("newemail.wma", 1)
                 $contacts = _INetGetSource($site&"/messenger/check2.php?login="&GUICtrlRead($Input1)&"&pass="&$pass&"&act=cont2")
                GUIDelete()
        

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("YourSpace Messenger", 232, 537, 193, 125)
$TreeView = GUICtrlCreateTreeView(0, 0, 232, 537)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
    $online = GUICtrlCreateTreeViewItem("online", $treeview)
    GUICtrlSetColor(-1, 0x0000C0)
    $offline = GUICtrlCreateTreeViewItem("offline", $treeview)
    GUICtrlSetColor(-1, 0xff0000)
    $contactsx = StringSplit($contacts, " ")
    $contactsy = UBound($contactsx)
    $xy = 2
while $xy < $contactsy
    $onlineuser = GUICtrlCreateTreeViewItem($contactsx[$xy], $online)
    $xy = $xy + 1
    WEnd
GUICtrlSetState($online, BitOR($GUI_EXPAND, $GUI_DEFBUTTON))

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Form1, "int", 200, "long", 0x00090000)
            TraySetIcon("hidden.ico")
            GUISetState(@SW_HIDE)

    EndSwitch
WEnd

                Else
                msgbox(64, "No", "login unsucessfull")
                DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Form1, "int", 200, "long", 0x00090000)
            exit
            EndIf

    EndSwitch
WEnd


Func _wmpcreate($show, $left, $top, $width = 100, $height = 100)
$oWMP = ObjCreate("WMPlayer.OCX")
If $oWMP = 0 Then Return 0
$oWMP.settings.autoStart = "False"
If $show = 1 Then
    GUICtrlCreateObj($oWMP, $left, $top, $width, $height)
EndIf
Return $oWMP
EndFunc

Func _wmploadmedia( $object, $URL, $autostart = 1 )
    $object.URL = $URL
    While Not $object.controls.isAvailable("play")
        Sleep(1)
    WEnd
    If $autostart = 1 Then $object.controls.play()
EndFunc

Func _wmpvalue( $object, $setting, $para=1 )
        Select
            Case $setting = "play"
            If $object.controls.isAvailable("play") Then $object.controls.play()
        Case $setting = "stop"
            If $object.controls.isAvailable("stop") Then $object.controls.stop()
        Case $setting = "pause"
            If $object.controls.isAvailable("pause") Then $object.controls.pause()
        Case $setting = "invisible"
            $object.uiMode = "invisible"
        Case $setting = "controls"
            $object.uiMode = "mini"
        Case $setting = "nocontrols"
            $object.uiMode = "none"
        Case $setting = "fullscreen"
            $object.fullscreen = "true"
        Case $setting = "step"
            If $object.controls.isAvailable("step") Then $object.controls.step($para)
        Case $setting = "fastForward"
            If $object.controls.isAvailable("fastForward") Then $object.controls.fastForward()
        Case $setting = "fastReverse"
            If $object.controls.isAvailable("fastReverse") Then $object.controls.fastReverse()
        Case $setting = "volume"
            $object.settings.volume = $para
        Case $setting = "rate"
            $object.settings.rate = $para
        Case $setting = "playcount"
            $object.settings.playCount = $para
        Case $setting = "setposition"
            $object.controls.currentPosition = $para
        Case $setting = "getposition"
            Return $object.controls.currentPosition
        Case $setting = "getpositionstring";Returns HH:MM:SS
            Return $object.controls.currentPositionString
        Case $setting = "getduration"
            Return $object.currentMedia.duration
    EndSelect
EndFunc

func _MD5($stext)
    $s_url = $site&"/messenger/md5.php?text="&$stext
    $s_header = ''
    Local $h_DLL = DllOpen("wininet.dll")

    Local $ai_IRF, $md5 = ''

    Local $ai_IO = DllCall($h_DLL, 'int', 'InternetOpen', 'str', "AutoIt v3", 'int', 0, 'int', 0, 'int', 0, 'int', 0)
    If @error Or $ai_IO[0] = 0 Then
        DllClose($h_DLL)
        SetError(1)
        Return ""
    EndIf

    Local $ai_IOU = DllCall($h_DLL, 'int', 'InternetOpenUrl', 'int', $ai_IO[0], 'str', $s_URL, 'str', $s_Header, 'int', StringLen($s_Header), 'int', 0x80000000, 'int', 0)
    If @error Or $ai_IOU[0] = 0 Then
        DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IO[0])
        DllClose($h_DLL)
        SetError(1)
        Return ""
    EndIf

    Local $v_Struct = DllStructCreate('udword')
    DllStructSetData($v_Struct, 1, 1)

    While DllStructGetData($v_Struct, 1) <> 0
        $ai_IRF = DllCall($h_DLL, 'int', 'InternetReadFile', 'int', $ai_IOU[0], 'str', '', 'int', 256, 'ptr', DllStructGetPtr($v_Struct))
        $md5 &= StringLeft($ai_IRF[2], DllStructGetData($v_Struct, 1))
    WEnd

    DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IOU[0])
    DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IO[0])
    DllClose($h_DLL)
    Return $md5

EndFunc

func _RegisterProtocol($pname,$pcommandloc)
$tkey="HKEY_CLASSES_ROOT\"&$pname
RegWrite($tkey)
sleep(10)
RegWrite($tkey,"","REG_SZ","URL: "&$pname&" protocol")
sleep(10)
RegWrite($tkey,"URL Protocol","REG_SZ","")
sleep(10)

RegWrite($tkey&"\shell")
sleep(10)
RegWrite($tkey&"\shell\open")
sleep(10)
RegWrite($tkey&"\shell\open\command")
sleep(10)
RegWrite($tkey&"\shell\open\command","","REG_SZ",'"'&$pcommandloc&'" %1')
sleep(10)

MsgBox(0,"Fin","protocol "&$pname&": registered.",2)
Exit
EndFunc

Func _SpeakToWAV($sText,$sFile)
    $ObjVoice=ObjCreate("Sapi.SpVoice")
    $ObjFile=ObjCreate("SAPI.SpFileStream.1")
    $objFile.Open($sFile,3)
    $objVoice.AudioOutputStream = $objFile
    $objVoice.Speak ($sText)
EndFunc

Func _GoogleTranslate($sText, $sFrom = "en", $sTo = "ja")
    Local Const $FileName = "Translation.jsn"
    Local Const $Pattern = '"translatedText":"([^"]+)"'
    Local $GoogleURL = "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=%s&langpair=%s%%7C%s"
    Local $File
    
    $GoogleURL = StringFormat($GoogleURL, $sText, $sFrom, $sTo)
    
    If Not InetGet($GoogleURL, $FileName, 1) Then Return SetError(1, 0, 0)
        
    $File = FileOpen($FileName, 4)
    FileGetSize($FileName)
    $Translation = FileRead($File, FileGetSize($FileName))
    FileClose($File)
    FileDelete($FileName)
    
    $Translation = BinaryToString($Translation, 4)

    If StringRegExp($Translation , $Pattern) Then
        $Translation = StringRegExp($Translation , $Pattern, 1)
        $Translation = $Translation[0]
        
        Return $Translation
    EndIf
EndFunc

func Terminate()
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Form, "int", 200, "long", 0x00090000)
    Exit
EndFunc

func show()
    TraySetIcon("show.ico")
    GUISetState(@SW_SHOW)
EndFunc

Func GradientFill($im, $x1, $y1, $width, $height, $left_color, $right_color)

    $color0=($left_color[0]-$right_color[0])/$height
    $color1=($left_color[1]-$right_color[1])/$height
    $color2=($left_color[2]-$right_color[2])/$height
    For $Y=0 to $height

        $red=$left_color[0]-floor($Y*$color0)
        $green=$left_color[1]-floor($Y*$color1)
        $blue=$left_color[2]-floor($Y*$color2)
        
        ;Convert RGB to decimal
        $col = Dec(Hex($blue,2) & Hex($green,2) & Hex($red,2))
        
        GUICtrlSetGraphic($im,$GUI_GR_COLOR, $col)
        GUICtrlSetGraphic($im,$GUI_GR_MOVE,0,$Y)
        GUICtrlSetGraphic($im,$GUI_GR_LINE,$GUIWidth,$Y)
    Next
EndFunc

Func TextEffect($Text, $Left, $Top, $Fontsize, $Fontspace, $Step, $Delay, $Color, $Color2, $Colorstep, $Colorstep2, $Shadow, $Gradient)
    $Color = Colors($Color, $Color2, $Colorstep, $Colorstep2)
    $Letters = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v"
 $letters&=",w,x,y,z,0,1,2,3,4,5,6,7,8,9"
    $Let = StringSplit($Letters, ",", 1)
    $Len = StringLen($Text)
    Local $Control[$Len + 1], $Fontspace2 = 0
    For $i = 1 To $Len
        $pLeft = (($Left + ($i * $Fontspace)) - $Fontspace2) - $Fontspace
        $Control[$i] = GUICtrlCreateLabel("", $pLeft, 0, $Fontspace, $Fontspace * 2)
        GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
        GUICtrlSetFont(-1, $Fontsize)
        $sLeft = StringLeft($Text, $i)
        If $i <> 1 Then $sLeft = StringTrimLeft($sLeft, $i - 1)
        If $sLeft <> " "  Then
            For $z = 1 To $Step
                GUICtrlSetPos(-1, $pLeft, $z * ($Top / $Step))
                $Text2 = $Let[Random(1, UBound($Let) - 1, 1)]
                GUICtrlSetData(-1, $Text2)
                GUICtrlSetColor(-1, $Color[$z * ($Colorstep / $Step)])
                Sleep($Delay)
            Next
        EndIf
        GUICtrlSetData(-1, $sLeft)
        If $Gradient = 1 Then
            If $i < $Len / 2 Then
                GUICtrlSetColor(-1, $Color[$Colorstep - ($i * (($Colorstep / 2) / ($Len / 2)))])
            Else
                GUICtrlSetColor(-1, $Color[($Colorstep / 2) + (($i - ($Len / 2)) * (($Colorstep / 2) / ($Len / 2)))])
            EndIf
        EndIf
        If $Shadow = 1 Then
            GUICtrlCreateLabel($sLeft, $pLeft - 3, $Top + 3, $Fontspace, $Fontspace * 2)
            GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
            GUICtrlSetColor(-1, $Color[$Step / 1.2])
            GUICtrlSetFont(-1, $Fontsize)
            GUICtrlSetPos($Control[$i], $pLeft, $Top)
        EndIf
        If $sLeft = "i"  Or $sLeft = "i"  Then $Fontspace2 += $Fontspace / 2
        If $sLeft = "f"  Or $sLeft = "l"  Then $Fontspace2 += $Fontspace / 2.5
    Next
EndFunc   ;==>TextEffect

Func Colors($nStartColor = 0x00FF00, $nEndColor = 0x000000, $Step = 50, $Step2 = 50)
    Local $color1R = _ColorGetRed($nStartColor)
    Local $color1G = _ColorGetGreen($nStartColor)
    Local $color1B = _ColorGetBlue($nStartColor)
    Local $nStepR = (_ColorGetRed($nEndColor) - $color1R) / $Step2
    Local $nStepG = (_ColorGetGreen($nEndColor) - $color1G) / $Step2
    Local $nStepB = (_ColorGetBlue($nEndColor) - $color1B) / $Step2
    For $i = 1 To $Step
        $sColor = "0x" & StringFormat("%02X%02X%02X", $color1R + $nStepR * $i, $color1G + $nStepG * $i, $color1B + $nStepB * $i)
        If $i = 1 Then
            $Colors = $sColor
        Else
            $Colors &= "," & $sColor
        EndIf
    Next
    $Colors = StringSplit($Colors, ",", 1)
    Return $Colors
EndFunc   ;==>Colors

func _unicodeini($inifile, $section, $key)
$LangFile = FileOpen($inifile, 128)
$inifilec = FileRead($LangFile)
$inisets = StringSplit($inifilec, "~")
$y = UBound($inisets)
$x = 1
while $x < $y
    $string = StringSplit($inisets[$x], "]")
    $string2 = StringReplace($string[1], "[", "")
    $x = $x + 1
    $test = StringInStr($string2, $section)
    if $test = 0 Then
        
    Else
        $inikey = StringSplit($string[2], "=")
        $b = UBound($inikey)
        $a=1
        while $a < $b
        $test = StringInStr($inikey[$a], $key)
        
        $a = $a + 1
    if $test = 0 Then
        
    Else
        return $inikey[$a]
    EndIf
WEnd

    EndIf
    
    
wend
EndFunc

required files + source zipped:

http://notmyspace.info/messenger/surz.zip

Edited by emoyasha

Admin Of:http://notmyspace.info [Under Development, looking for volunteers to help improve]http://PSNetCards.co.ukhttp://ZacnAndLindsey.com [Under development, not quite sure what to do with it yet]http://revelm.com------------------------------------Radio Streams:http://75.185.53.88:8000 [128kb/s 44kHz]http://75.185.53.88:8002 [22kb/s 22kHz](works on mobile phones)-----------------------------------My Server:Owned By: http://jumpline.comIP:66.84.19.220Bandwidth:200GBStorage Space:1TBNetwork Connection: 1GB/S[up and down]Operating System: Red Hat LinuxInstalled Apps:Webmail, phpBB, Majordomo, phpMyAdmin, MySQL, Active Server Pages, FrontPage Extensions 2002, GraphicsMagick, Mod Perl, Perl, PHP: Hypertext Preprocessor, Python(want cheap good webhosting, or need a place to park your domain? contact me)-----------------------------------

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