Jump to content

[solved] How using $GUI_GR_BEZIER ?


Go to solution Solved by ioa747,

Recommended Posts

Posted (edited)

how can I make a rectangle with rounded corners, using $GUI_GR_BEZIER ?

I've tried a lot without success, and the worst thing is I didn't understand how it works

any help appreciated
Thank you very much

#include <GUIConstants.au3>


Global $hGUI = GUICreate("GUI")

Global $id_1 = _CreateInput("INPUT1", 20, 20, 150, 30, "0xB6FF00")
Global $id_2 = _CreateInput("INPUT2", 20, 70, 150, 35, "0xFFD800")
Global $id_3 = _CreateInput("INPUT3", 20, 120, 150, 40, "0xFFB400")

Global $id_4 = _CreateInputWL("Test Label:", "INPUT4", 220, 20, 150, 30, "0xB6FF00")
Global $id_5 = _CreateInputWL("Test Label:", "input5", 220, 70, 150, 35, "0xFFD800")
Global $id_6 = _CreateInputWL("Test Label:", "INPUT6", 220, 120, 150, 40, "0xFFB400")

Global $id_7 = _CreateInput2("INPUT7", 20, 250, 150, 30, "0xFFB400")

GUISetState()



Sleep(3000)

GUICtrlSetData($id_1, "[test] gyps")
GUICtrlSetData($id_4, "[test] gyps")

While True
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd


;--------------------------------------------------------------------------------------------------------------------------------
Func _CreateInput($Text, $Left, $Top, $Width, $Height, $Color)
    GUICtrlCreateGraphic($Left, $Top, $Width, $Height)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, $Height, $Height)
    GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, $Width - $Height, 0, $Height, $Height)
    GUICtrlSetGraphic(-1, $GUI_GR_RECT, ($Height / 2), 0, $Width - $Height, $Height)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $idInput1 = GUICtrlCreateInput($Text, $Left + ($Height * 0.2), $Top + ($Height * 0.2), $Width - ($Height * 0.4), $Height - ($Height * 0.4), -1, $WS_EX_TOOLWINDOW)
    GUICtrlSetFont(-1, Int($Height * 0.4), 400)
    GUICtrlSetBkColor(-1, $Color)
    Return $idInput1
EndFunc   ;==>_GUICtrlCreateRndInput5
;--------------------------------------------------------------------------------------------------------------------------------
Func _CreateInputWL($Label, $Text, $Left, $Top, $Width, $Height, $Color)
    GUICtrlCreateGraphic($Left, $Top, $Width, $Height)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, $Height, $Height)
    GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, $Width - $Height, 0, $Height, $Height)
    GUICtrlSetGraphic(-1, $GUI_GR_RECT, ($Height / 2), 0, $Width - $Height, $Height)
    GUICtrlSetState(-1, $GUI_DISABLE)

    GUICtrlCreateLabel($Label, $Left + ($Height * 0.4), $Top, $Width - ($Height * 0.8), $Height * 0.4)
    GUICtrlSetBkColor(-1, $Color)
    GUICtrlSetFont(-1, Int($Height * 0.25), 400)

    $idInput1 = GUICtrlCreateInput($Text, $Left + ($Height * 0.3), $Top + ($Height * 0.35), $Width - ($Height * 0.6), $Height * 0.6, -1, $WS_EX_TOOLWINDOW)
    GUICtrlSetFont(-1, Int($Height * 0.4), 400)
    GUICtrlSetBkColor(-1, $Color)
    Return $idInput1
EndFunc   ;==>_GUICtrlCreateRndInput6
;--------------------------------------------------------------------------------------------------------------------------------
Func _CreateInput2($Text, $Left, $Top, $Width, $Height, $Color)
    GUICtrlCreateGraphic($Left, $Top, $Width, $Height)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color, $Color)

    GUICtrlSetGraphic(-1, $GUI_GR_HINT, 3) ; to display control lines and end points

    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 150, 15) ; start point
    GUICtrlSetGraphic(-1, $GUI_GR_BEZIER, 135, 30, 150, 30, 150, 30)

    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 30, 30) ; start point
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, 135, 30) ; start point
;~  GUICtrlSetGraphic(-1, $GUI_GR_BEZIER, 20, 20, 0, 40, 40, 0)
;~  ;GUICtrlSetGraphic(-1, $GUI_GR_BEZIER + $GUI_GR_CLOSE, 100, 40, 40, 100, 40, 20)
;~  GUICtrlSetState(-1, $GUI_DISABLE)

;~  $idInput1 = GUICtrlCreateInput($Text, $Left + ($Height * 0.2), $Top + ($Height * 0.2), $Width - ($Height * 0.4), $Height - ($Height * 0.4), -1, $WS_EX_TOOLWINDOW)
;~  GUICtrlSetFont(-1, Int($Height * 0.4), 400)
;~  GUICtrlSetBkColor(-1, $Color)
;~  Return $idInput1
EndFunc   ;==>_GUICtrlCreateRndInput7
;--------------------------------------------------------------------------------------------------------------------------------

 

Edited by ioa747

I know that I know nothing

  • ioa747 changed the title to [solved] How using $GUI_GR_BEZIER ?
  • 9 months later...

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