Jump to content

[solved] How using $GUI_GR_BEZIER ?


Recommended Posts

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

Link to comment
Share on other sites

it was resolved :)

#include <GUIConstants.au3>


Global $hGUI = GUICreate("GUI")

Global $id_1 = _CreateInput("INPUT1", 20, 20, 150, 30, "0xB6FF00", 10)
Global $id_2 = _CreateInput("INPUT2", 20, 60, 150, 30, "0xB6FF00")

Global $id_3 = _CreateInput("INPUT3", 20, 100, 150, 35, "0xFFD800", 10)
Global $id_4 = _CreateInput("INPUT4", 20, 145, 150, 35, "0xFFD800")

Global $id_5 = _CreateInput("INPUT5", 20, 190, 150, 40, "0xFFB400", 10)
Global $id_6 = _CreateInput("INPUT6", 20, 240, 150, 40, "0xFFB400")

Global $id_7 = _CreateInputWL("Test Label:", "INPUT7", 220, 20, 150, 30, "0xB6FF00", 10)
Global $id_8 = _CreateInputWL("Test Label:", "INPUT8", 220, 60, 150, 30, "0xB6FF00")

Global $id_9 = _CreateInputWL("Test Label:", "INPUT9", 220, 100, 150, 30, "0xB6FF00", 10)
Global $id_10 = _CreateInputWL("Test Label:", "INPUT10", 220, 145, 150, 30, "0xB6FF00")

Global $id_11 = _CreateInputWL("Test Label:", "INPUT11", 220, 190, 150, 40, "0xFFB400", 10)
Global $id_12 = _CreateInputWL("Test Label:", "INPUT12", 220, 240, 150, 40, "0xFFB400")

GUISetState()



Sleep(3000)

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

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

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

 

I know that I know nothing

Link to comment
Share on other sites

  • ioa747 changed the title to [solved] How using $GUI_GR_BEZIER ?

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