Jump to content

_GuiRoundCorners


Recommended Posts

I found this function a while ago:

Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3);==>_GuiRoundCorners
   Dim $pos, $ret, $ret2
   $pos = WinGetPos($h_win)
    $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long",  $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3,  "long", $i_y3)
   If $ret[0] Then
      $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1)
      If $ret2[0] Then
         Return 1
      Else
         Return 0
      EndIf
   Else
      Return 0
   EndIf
EndFunc;==>_GuiRoundCorners

And i was wondering if there is something like this for controls?

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Link to comment
Share on other sites

I found this function a while ago:

Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3);==>_GuiRoundCorners
   Dim $pos, $ret, $ret2
   $pos = WinGetPos($h_win)
    $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long",  $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3,  "long", $i_y3)
   If $ret[0] Then
      $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1)
      If $ret2[0] Then
         Return 1
      Else
         Return 0
      EndIf
   Else
      Return 0
   EndIf
EndFunc;==>_GuiRoundCorners

And i was wondering if there is something like this for controls?

Try just passing the control's HWND vice the window's.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Try just passing the control's HWND vice the window's.

:)

If you mean calling the function with a control handle as the first variable i tried that an it didn't seem to work.

: ==> Subscript used with non-Array variable.:

$ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3)

$ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos^ ERROR

Edited by MerkurAlex

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Link to comment
Share on other sites

Sorry guys im comepletely unsure what your telling me to do :/

P.S I'm sick and was not able to sleep at all last night so that is why i cannot understand.

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Link to comment
Share on other sites

I meant something like this, but it didn't work:

#include <GuiConstants.au3>

Global $hGUI = GUICreate("Test", 200, 200)
Global $ctrlGraphic = GUICtrlCreateGraphic(10, 10, 180, 80)
GUICtrlSetBkColor(-1, 0xFF)
Global $hGraphic = ControlGetHandle($hGUI, "", $ctrlGraphic)
Global $ctrlButton = GUICtrlCreateButton("Round It", 50, 150, 100, 30)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $ctrlButton
            $avPos = ControlGetPos($hGUI, "", $ctrlGraphic)
            _GuiRoundCorners($hGraphic, $avPos[0], $avPos[1], $avPos[0] + $avPos[2], $avPos[1] + $avPos[3])
    EndSwitch
WEnd

Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3);==>_GuiRoundCorners
   Dim $pos, $ret, $ret2
   $pos = WinGetPos($h_win)
    $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long",  $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3,  "long", $i_y3)
   If $ret[0] Then
      $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1)
      If $ret2[0] Then
         Return 1
      Else
         Return 0
      EndIf
   Else
      Return 0
   EndIf
EndFunc;==>_GuiRoundCorners

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

it works with a Label :)

#include <GuiConstants.au3>

Global $hGUI = GUICreate("Test", 200, 200)
Global $ctrlLabel = GUICtrlCreateLabel("",10, 10, 180, 80)
GUICtrlSetBkColor(-1, 0xFF)
Global $hLabel = GUICtrlGetHandle( $ctrlLabel)
Global $ctrlButton = GUICtrlCreateButton("Round It", 50, 150, 100, 30)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $ctrlButton
            $avPos = ControlGetPos($hGUI, "", $ctrlLabel)
            _GuiRoundCorners($hLabel, $avPos[0], $avPos[1], $avPos[0] + $avPos[2], $avPos[1] + $avPos[3])
    EndSwitch
WEnd

Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3);==>_GuiRoundCorners
   Dim $pos, $ret, $ret2
   $pos = WinGetPos($h_win)
    $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long",  $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3,  "long", $i_y3)
   If $ret[0] Then
      $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1)
      If $ret2[0] Then
         Return 1
      Else
         Return 0
      EndIf
   Else
      Return 0
   EndIf
EndFunc;==>_GuiRoundCorners

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

it works with a Label :(

Cool! Thank for the tip.

:)

Edit: Threw some text into the label:

#include <GuiConstants.au3>
#include <StaticConstants.au3>

Global $hGUI = GUICreate("Test", 200, 200)
Global $ctrlLabel = GUICtrlCreateLabel(@LF & @LF & "My Text Label",10, 10, 180, 80, $SS_CENTER)
GUICtrlSetBkColor(-1, 0xFF)
Global $hLabel = GUICtrlGetHandle( $ctrlLabel)
Global $ctrlButton = GUICtrlCreateButton("Round It", 50, 150, 100, 30)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $ctrlButton
            $avPos = ControlGetPos($hGUI, "", $ctrlLabel)
            _GuiRoundCorners($hLabel, $avPos[0], $avPos[1], $avPos[0] + $avPos[2], $avPos[1] + $avPos[3])
    EndSwitch
WEnd

Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3);==>_GuiRoundCorners
   Dim $pos, $ret, $ret2
   $pos = WinGetPos($h_win)
    $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long",  $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3,  "long", $i_y3)
   If $ret[0] Then
      $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1)
      If $ret2[0] Then
         Return 1
      Else
         Return 0
      EndIf
   Else
      Return 0
   EndIf
EndFunc;==>_GuiRoundCorners
Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Thanks guys believe it or not i only needed it for a label :)

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

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