Jump to content

Round GUI


Andreik
 Share

Recommended Posts

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.

Link to comment
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
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...