Sign in to follow this  
Followers 0
Andreik

Round GUI

5 posts in this topic

#1 ·  Posted (edited)

I write a simple script with a round GUI, maybe someone wants to create something similar in the future in his script. Function _RoundCorners exist on the forum with name _GuiRoundCorners, isn't something new.

$Color1 = 0x000080
$Color2 = 0xFF0080
Dim $Control[3]

$GUI = GUICreate("",600,400,-1,-1,0x80000000)
_RoundCorners($GUI,400,400)
$Control[0] = GUICtrlCreateButton("x",430,120,20,20)
$Control[1] = GUICtrlCreateInput("Type here your name",200,150,200,20,0x01)
$Control[2] = GUICtrlCreateButton("OK",250,220,100,30)
ControlColor($Control,$Color1,$Color2)
GUISetBkColor(0x0080FF,$GUI)
GUISetState()

While 1
    $MSG = GUIGetMsg()
    If $MSG = $Control[2] Then
        If GUICtrlRead($Control[1]) <> "Type here your name" Then
            TrayTip("Nice name",GUICtrlRead($Control[1]),1)
        EndIf
    ElseIf $MSG = $Control[0] Then
        Exit
    EndIf
    Sleep(15)
WEnd

Func _RoundCorners($GUI,$X=5,$Y=5)
    $pos = WinGetPos($GUI)
    $x1 = $pos[0]
    $y1 = $pos[1]
    $x2 = $pos[2] - $x1
    $y2 = $pos[3] - $y1
    $dll = DllOpen("gdi32.dll")
    $res = DllCall("gdi32.dll","long","CreateRoundRectRgn","int",$x1,"int",$y1,"int",$x2,"int",$y2,"int",$X,"int",$Y)
    If $res[0] Then
    $dll2 = DllOpen("user32.dll")
    $res2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd",$GUI,"long",$res[0],"int",1)
    DllClose($dll2)
    DllClose($dll)
    If $res2[0] Then
         Return 1
      Else
         Return 0
     EndIf
     Else
      Return 0
   EndIf
EndFunc;==>_RoundCorners

Func ControlColor($ControlArray,$BkColor,$Color)
    For $Index = 0 To UBound($ControlArray)-1
        GUICtrlSetBkColor($ControlArray[$Index],$BkColor)
        GUICtrlSetColor($ControlArray[$Index],$Color)
    Next
EndFunc;==>ControlColor
Edited by Andreik

When the words fail... music speaks

Share this post


Link to post
Share on other sites



Cool, but can we get some AA goin' on here? Looks kinda ugly.


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

Cool, but can we get some AA goin' on here? Looks kinda ugly.

You are free to do it as beautiful. >_< :)

When the words fail... music speaks

Share this post


Link to post
Share on other sites

create good looking button like this

Posted Image

i think you can't do it.......


Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, ‘What happened?’” –Casey Stengel

Share this post


Link to post
Share on other sites

create good looking button like this

Posted Image

i think you can't do it.......

It`s just an example. If that is so ugly you can not learn something ... :)

When the words fail... music speaks

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