Jump to content

Recommended Posts

Posted

Yes, of course. Sorry about that. In the following example, if you do the rounded input or the rounded group separately, they both end up rounded as expected. Initially, try the script with just the input enabled. It's rounded. Then remove the comment from the rounded group and run script again. You'll notice that the group is rounded but the input on the inside of the group is squared.

Spoiler
#include "RoundGUI.au3"

Opt("GUIOnEventMode", 1)

$hGUI = GUICreate("test", 500, 500)
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")

GUISetBkColor(0x202020)


_RGUI_RoundInput("test input", 0xFFFFFF, 100, 100, 200, 200, 0x404040, 0X404040, 15, 6)

;_RGUI_RoundGroup("Advanced", 0xffffff, 75, 75, 300, 300, 0x404040, 0x202020, 8, 6)

GUISetState()

While 1
    Sleep(1000)
WEnd

Func SpecialEvents()
    Select
        Case @GUI_CtrlId = $GUI_EVENT_CLOSE
Exit
    EndSelect
EndFunc

 

 

Posted
15 minutes ago, WildByDesign said:

but the input on the inside of the group is squared.

#include "RoundGUI.au3"

Opt("GUIOnEventMode", 1) ;;; https://www.autoitscript.com/forum/topic/212767-round-corner-gui-and-controls-udf/page/2/#comment-1544167

$hGUI = GUICreate("test", 500, 500)
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")

GUISetBkColor(0x202020)

_RGUI_RoundGroup($hGUI, "Advanced", 0xffffff, 75, 75, 300, 300, 0x404040, 0x202020, 8, 6)
_RGUI_RoundInput("test input", 0xFFFFFF, 100, 100, 200, 200, 0x404040, 0X404040, 15, 6)
GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group

GUISetState()

While Sleep(1000)
WEnd

Func SpecialEvents()
    Select
        Case @GUI_CtrlId = $GUI_EVENT_CLOSE
            GUIDelete()
            Exit
    EndSelect
EndFunc   ;==>SpecialEvents

You may need to read about GUICtrlCreateGroup().

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

  • 2 months later...
Posted (edited)

For the functions to be more user-friendly and similar to the default functions... Can the Color parameters possibly be replaced with a parameter that's a handle to the parent GUI, where you can get DefBkColor (_WinAPI_GetBkColor) and DefColor (_WinAPI_SetTextColor return value) from there? (and optionally add _RGUI_SetColor / _RGUI_SetBKColor)

 

Edit: I've attached a modified UDF mostly working with the proposed changes implemented... but the background keeps drawing as transparent for some reason.

 

 

RoundGUI.au3 RoundGUI Example1.au3

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11, MSEdgeRedirect
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Posted (edited)

EDIT: These bugs are for the unmodified UDF (not the one with the proposed changes)

Bug Report 1: If GUICtrlSetDefColor was called anywhere in the code before your RGUI functions the rounded corners get squared off.

del.png

 

Bug Report 2: Having a Pic behind an _RGUI Control causes the Rounded Elements to not be drawn.

#include <GDIPlus.au3>
#include <WinAPITheme.au3>
#include "RoundGUI.au3"

; #DESCRIPTION# ========================================
; Title .........: Round GUI UDF - Example 1
; AutoIt Version : 3.3.16.1
; Description ...: Example of the Round Corner GUI UDF
; Goal ..........: Show creation of different controls
; Author ........: Nine
; Date ..........: 2025-03-28
; ======================================================

Opt("MustDeclareVars", True)

Example()

Func Example()
  Local $hGUI = GUICreate("Example", 600, 500, -1, -1, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_CONTROLPARENT)
  GUISetBkColor(0xC0FFEE)
  GUISetFont(11, 0, 0, "Comic Sans MS")
  _WinAPI_SetLayeredWindowAttributes($hGUI, 0xC0FFEE)

  _GDIPlus_Startup()

; Background that screws things up
  Local $hBackground = GUICtrlCreatePic("", 0, 0, 600, 500)
  Local $hBackgroundFile = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\" & "test.png")
  Local $hBackgroundImage = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBackgroundFile)
  _WinAPI_DeleteObject(GUICtrlSendMsg($hBackground, $STM_SETIMAGE, $IMAGE_BITMAP, $hBackgroundImage))

  _GDIPlus_Shutdown()

  _RGUI_RoundRect(0, 0, 600, 500, 0x202020, 0x202020, 20)
  _RGUI_RoundLabel("Example", 0xFFFFFF, 10, 10, 580, 30, 0xFFFFFF, -2, 15, True)
  GUICtrlSetFont(-1, 13)
  _RGUI_DrawLine(110, 40, 110, 480, 0x808080)

  Local $idClear = _RGUI_RoundButton("Clear", 0xB0B0B0, 10, 50, 80, 30, 0xFF00, 0X404040, 15)
  Local $idCopy = _RGUI_RoundButton("Copy", 0xB0B0B0, 10, 90, 80, 30, 0xFF00, 0X404040, 15)
  Local $idExit = _RGUI_RoundButton("Exit", 0xB0B0B0, 10, 450, 80, 30, 0xFF00, 0X404040, 15)

  Local $idInput = _RGUI_RoundInput("Enter something", 0xFFFFFF, 130, 60, 400, 30, 0xFF00, 0X404040, 15, 6)
  Local $idEdit = _RGUI_RoundEdit("Enter something here also", 0xFFFFFF, 130, 110, 400, 180, 0X404040, 0X404040, 15, 8, $ES_WANTRETURN + $WS_VSCROLL + $ES_AUTOVSCROLL)

  Local $idGroup = _RGUI_RoundGroup("Group", 0xB0B0B0, 130, 320, 180, 150, 0x808080, 0x202020, 15, 3)
  GUICtrlSetFont(-1, 10)
  Local $idOpt1 = GUICtrlCreateRadio("Option 1", 150, 350, 80, 20)
  _WinAPI_SetWindowTheme(GUICtrlGetHandle($idOpt1), "0", "0")
  GUICtrlSetBkColor(-1, 0x202020)
  GUICtrlSetColor(-1, 0xB0B0B0)
  Local $idOpt2 = GUICtrlCreateRadio("Option 2", 150, 390, 80, 20)
  _WinAPI_SetWindowTheme(GUICtrlGetHandle($idOpt2), "0", "0")
  GUICtrlSetBkColor(-1, 0x202020)
  GUICtrlSetColor(-1, 0xB0B0B0)
  GUICtrlCreateGroup("", -99, -99)

  _RGUI_RoundLabel("Auto-Size", 0xB0B0B0, 350, 320, -1, -1, 0x404040, 0X404040, 15)

  GUISetState()

  Local $idCtrl
  While True
    Switch GUIGetMsg()
      Case $GUI_EVENT_CLOSE, $idExit
        ExitLoop
      Case $GUI_EVENT_PRIMARYDOWN
        $idCtrl = _RGUI_ButtonPress($idClear, $idCopy, 0xFF00)
      Case $GUI_EVENT_PRIMARYUP
        _RGUI_ButtonReset($idCtrl, 0xB0B0B0)
      Case $idInput
        ConsoleWrite("Input" & @CRLF)
      Case $idEdit
        ConsoleWrite("Edit" & @CRLF)
      Case $idClear
        GUICtrlSetData($idInput, "")
      Case $idCopy
        ClipPut(GUICtrlRead($idEdit))
    EndSwitch
  WEnd
EndFunc   ;==>Example


Test.png:

test.png

Edited by rcmaehl
Update Bug 2. Apparently wasn't calling GDI Startup/Shutdown

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11, MSEdgeRedirect
Cisco FinesseGithubIRC UDFWindowEx UDF

 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...