Jump to content

GUICtrlCreateEdge


layer
 Share

Recommended Posts

as you can see, i was really, really, really, really, really bored when i wrote this... because any noob could have done it, but hey! no one did yet so i might as well, i dont even know if its useful..

Func GUICtrlCreateEdge($x, $y, $width, $height)
    GUICtrlCreateLabel("", $x, $y, $width, $height, 0x1000)
EndFunc

GUICreate("")
GUISetState()
GUICtrlCreateEdge(50, 50, 100, 100)
sleep(3000)

no idea how to do diagonal lines

no color support

:)

FootbaG
Link to comment
Share on other sites

diagonal lines with GuiCtrlCreateGraphic

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Link to comment
Share on other sites

updated a little... with colors! check it out :D

Global $edge
Func GUICtrlCreateEdge($x, $y, $width, $height, $color)
    $edge= GUICtrlCreateLabel("", $x, $y, $width, $height, 0x1000)
    GUICtrlSetBkColor($edge, $color)
EndFunc

GUICreate("Edge demo")
GUICtrlSetBkColor($edge, 0x00FF00)
GUISetState()
GUICtrlCreateEdge(50, 50, 5, 100, 0x00FF00)
GUICtrlCreateEdge(50, 50, 100, 5, 0x00FF00)
GUICtrlCreateEdge(150, 50, 5, 100, 0x00FF00)
GUICtrlCreateEdge(50, 150, 105, 5, 0x00FF00)

GUICtrlCreateEdge(75, 75, 5, 100, 0xFF0000)
GUICtrlCreateEdge(75, 75, 100, 5, 0xFF0000)
GUICtrlCreateEdge(175, 75, 5, 100, 0xFF0000)
GUICtrlCreateEdge(75, 175, 105, 5, 0xFF0000)

GUICtrlCreateEdge(100, 100, 5, 100, 0x0000FF)
GUICtrlCreateEdge(100, 100, 100, 5, 0x0000FF)
GUICtrlCreateEdge(200, 100, 5, 100, 0x0000FF)
GUICtrlCreateEdge(100, 200, 105, 5, 0x0000FF)

GUICtrlCreateButton("Test", 300, 50, 30, 30)
GUICtrlCreateEdge(300, 46, 31, 5, 0x000000)
GUICtrlCreateEdge(300, 80, 31, 5, 0x000000)
GUICtrlCreateEdge(296, 50, 5, 31, 0x000000)
GUICtrlCreateEdge(329, 50, 5, 31, 0x000000)
While 1
    $get = GUIGetMsg()
    If $get = -3 then Exit
WEnd

hope you like :D

EDIT: added a button with edges around it, im not that artistic, so its not great, but i know it can be better :)

Edited by layer
FootbaG
Link to comment
Share on other sites

pretty slick how about a function to create a box.

Global $edge
Func GUICtrlCreateEdge($x, $y, $width, $height, $color)
    $edge= GUICtrlCreateLabel("", $x, $y, $width, $height, 0x1000)
    GUICtrlSetBkColor($edge, $color)
EndFunc

GUICreate("Edge demo")
GUISetState()
_GUICtrlCreateEdgeBox(50,50,5,100,0x00FF00)

_GUICtrlCreateEdgeBox(75, 75, 5, 100, 0xFF0000)

_GUICtrlCreateEdgeBox(100, 100, 5, 100, 0x0000FF)

GUICtrlCreateButton("Test", 300, 50, 30, 30)
_GUICtrlCreateEdgeBox(296, 45, 5, 35, 0x000000)

While 1
    $get = GUIGetMsg()
    If $get = -3 then Exit
WEnd    

Func _GUICtrlCreateEdgeBox($x,$y,$width,$height,$color)
    GUICtrlCreateEdge($x, $y, $width, $height, $color)
    GUICtrlCreateEdge($x, $y, $height, $width, $color)
    GUICtrlCreateEdge($height + $x, $y, $width, $height, $color)
    GUICtrlCreateEdge($x, $height + $y, $height + $width, $width, $color)
EndFunc
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Home sick and bored.

Global $edge
Func GUICtrlCreateEdge($x, $y, $width, $height, $color)
    $edge= GUICtrlCreateLabel("", $x, $y, $width, $height, 0x1000)
    GUICtrlSetBkColor($edge, $color)
EndFunc

GUICreate("Edge demo")
GUISetState()

_GUICtrlCreateEdgeBox(50,50,5,100,0x00FF00)
_GUICtrlCreateEdgeBox(75, 75, 5, 100, 0xFF0000)
_GUICtrlCreateEdgeBox(100, 100, 5, 100, 0x0000FF)

_GUICtrlCreateEdgeRectangle(50,250,5,100,0x00FF00)
_GUICtrlCreateEdgeRectangle(75, 275, 5, 100, 0xFF0000)
_GUICtrlCreateEdgeRectangle(100, 300, 5, 100, 0x0000FF)

_GUICtrlCreateEdgeRectangle(250,225,5,100,0x00FF00,0)
_GUICtrlCreateEdgeRectangle(275,250,5,100,0xFF0000,0)
_GUICtrlCreateEdgeRectangle(300,275,5,100,0x0000FF,0)

_GUICtrlCreateEdgeButton("Test", 300, 50, 30, 30,0x000000)

While 1
    $get = GUIGetMsg()
    If $get = -3 then Exit
WEnd    

Func _GUICtrlCreateEdgeBox($x,$y,$width,$height,$color)
; left vertical line
    GUICtrlCreateEdge($x, $y, $width, $height, $color)
; top horizontal line
    GUICtrlCreateEdge($x, $y, $height, $width, $color)
; right vertical line
    GUICtrlCreateEdge($height + $x, $y, $width, $height, $color)
; bottom horizontal line
    GUICtrlCreateEdge($x, $height + $y, $height + $width, $width, $color)
EndFunc

Func _GUICtrlCreateEdgeRectangle($x,$y,$width,$height,$color,$horizontal=1)
    If($horizontal) Then
    ; left vertical line
        GUICtrlCreateEdge($x, $y, $width, $height / 2, $color)
    ; top horizontal line
        GUICtrlCreateEdge($x, $y, $height, $width, $color)
    ; right vertical line
        GUICtrlCreateEdge($height + $x, $y, $width, $height / 2, $color)
    ; bottom horizontal line
        GUICtrlCreateEdge($x, ($height / 2) + $y, $height + $width, $width, $color)
    Else
    ; left vertical line
        GUICtrlCreateEdge($x, $y, $width, $height, $color)
    ; top horizontal line
        GUICtrlCreateEdge($x, $y, $height / 2, $width, $color)
    ; right vertical line
        GUICtrlCreateEdge(($height / 2) + $x, $y, $width, $height, $color)
    ; bottom horizontal line
        GUICtrlCreateEdge($x, $height + $y, ($height / 2) + $width, $width, $color)
    EndIf
EndFunc

Func _GUICtrlCreateEdgeButton($text,$x,$y,$width,$height,$color)
                Local $ctlid = GUICtrlCreateButton($text, $x, $y, $width, $height)
    _GUICtrlCreateEdgeBox($x - 4, $y - 5, 5, $height + 5, $color)
    Return $ctlid
EndFunc
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

@Slim: thanks slim :huh:

@gafrost: haha thats pretty neat :) i was going to do more boxes, but it was getting late! :D hmm, an idea just came up in my head... not sure if it will work, if u post it, you'll know it worked :D

FootbaG
Link to comment
Share on other sites

accident!

i present to you, diagonal lines!!!!!! :D

Global $edge
Func GUICtrlCreateEdge($x, $y, $width, $height, $color)
    $edge= GUICtrlCreateLabel("", $x, $y, $width, $height, 0x1000)
    GUICtrlSetBkColor($edge, $color)
EndFunc

GUICreate("Edge demo", 400, 400)
GUISetState()

For $i = 400 to 1 step -1
    GUICtrlCreateEdge($i, $i, 5, 5, 0x00FF00)
Next

While 1
    $get = GUIGetMsg()
    If $get = -3 then Exit
    WEnd

ill be working on it more too... :D

:)

FootbaG
Link to comment
Share on other sites

... it wasnt what i had in mind... but i was just experimenting! :D

Global $edge
Func GUICtrlCreateEdge($x, $y, $width, $height, $color)
    $edge= GUICtrlCreateLabel("", $x, $y, $width, $height, 0x1000)
    GUICtrlSetBkColor($edge, $color)
EndFunc

GUICreate("Edge demo", 400, 400)
GUISetState()

For $i = 400 to 1 step -1
    GUICtrlCreateEdge($i, $i, 5, 5, 0x00FF00)
    Sleep(10)
    GUICtrlCreateEdge($i+50, $i+50, 5, 5, 0xFF0000)
    Sleep(10)
    GUICtrlCreateEdge($i+100, $i+100, 5, 5, 0x0000FF)
    Sleep(10)
    GUICtrlCreateEdge($i+150, $i+150, 5, 5, 0x00FF00)
    Sleep(10)
    GUICtrlCreateEdge($i+200, $i+200, 5, 5, 0xFF0000)
    Sleep(10)
    GUICtrlCreateEdge($i+250, $i+250, 5, 5, 0x0000FF)
    Sleep(10)
    GUICtrlCreateEdge($i+300, $i+300, 5, 5, 0x00FF00)
    Sleep(10)
    GUICtrlCreateEdge($i+350, $i+350, 5, 5, 0xFF0000)
    Sleep(10)
    GUICtrlCreateEdge($i+400, $i+400, 5, 5, 0x0000FF)
    Sleep(10)
Next

While 1
    $get = GUIGetMsg()
    If $get = -3 then Exit
    WEnd

added the sleep(10)'s cause it took 100% CPU without em! but it doesnt take any on average with sleep(10) just a little slower... :)

FootbaG
Link to comment
Share on other sites

diagonal text!:

Global $edge
Func GUICtrlCreateEdge($text, $x, $y, $width, $height, $color)
    $edge= GUICtrlCreateLabel($text, $x, $y, $width, $height, 0x1000)
    GUICtrlSetBkColor($edge, $color)
    GUISetFont(14)
EndFunc

GUICreate("Edge demo", 400, 400)
GUISetState()

For $i = 1 to 2 step 1
    GUICtrlCreateEdge("t", $i, $i, 20, 20, 0x00FF00)
    Sleep(10)
    GUICtrlCreateEdge("e", $i+20, $i+20, 20, 20, 0xFF0000)
    Sleep(10)
    GUICtrlCreateEdge("s", $i+40, $i+40, 20, 20, 0x0000FF)
    Sleep(10)
    GUICtrlCreateEdge("t", $i+60, $i+60, 20, 20, 0x00FF00)
    Sleep(10)
Next

While 1
    $get = GUIGetMsg()
    If $get = -3 then Exit
    WEnd

:)

FootbaG
Link to comment
Share on other sites

Triangle

Global $edge
Func GUICtrlCreateEdge($x, $y, $width, $height, $color)
    $edge= GUICtrlCreateLabel("", $x, $y, $width, $height, 0x1000)
    GUICtrlSetBkColor($edge, $color)
EndFunc

GUICreate("Edge demo", 400, 400)
GUISetState()

_GUICtrlCreateEdgeTriangle(50,50,5,5,100,0x00FF00)

While 1
    $get = GUIGetMsg()
    If $get = -3 then Exit
WEnd

Func _GUICtrlCreateEdgeTriangle($x,$y,$width,$height,$length,$color)
    For $i = $length to $y step -1
         GUICtrlCreateEdge($i + $x, $i + $y, $width,$height, $color)
         GUICtrlCreateEdge(($length - $i) + $x, $i + $y, $width,$height, $color)
    Next
    GUICtrlCreateEdge($x, $length + $y, $length, $width, $color)
EndFunc

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

pixely cube :)

Global $edge
Func GUICtrlCreateEdge($x, $y, $width, $height, $color)
    $edge= GUICtrlCreateLabel("", $x, $y, $width, $height, 0x1000)
    GUICtrlSetBkColor($edge, $color)
EndFunc

GUICreate("Edge demo", 400, 400)

_GUICtrlCreateEdgeBox(100,100,5,100,0xFFFF00)
_GUICtrlCreateEdgeBox(50,150,5,100,0xFFFF00)
_GUICtrlCreateEdgeDiagonal(50,150,5,5,9,0xFFFF00)
_GUICtrlCreateEdgeDiagonal(150,150,5,5,9,0xFFFF00)
_GUICtrlCreateEdgeDiagonal(50,250,5,5,9,0xFFFF00)
_GUICtrlCreateEdgeDiagonal(150,250,5,5,9,0xFFFF00)

GUISetState ( )

While 1
    $get = GUIGetMsg()
    If $get = -3 then Exit
WEnd
    
Func _GUICtrlCreateEdgeBox($x,$y,$width,$height,$color)
    For $n = 0 To $height Step $width
    GUICtrlCreateEdge($x+$n, $y, $width, $width, $color)
    GUICtrlCreateEdge($x, $y+$n, $width, $width, $color)
    GUICtrlCreateEdge($height + $x, $y+$n, $width, $width, $color)
    GUICtrlCreateEdge($x + $n, $height + $y, $width, $width, $color)
    Next
EndFunc

;Pixel like diagonal edge creator
Func _GUICtrlCreateEdgeDiagonal($x,$y,$w,$h,$l,$c)
    For $n = 1 To $l
        GuiCtrlCreateEdge($x+($n*$w),$y-($n*$w),$w,$h,$c)
    Next
EndFunc

edit: tiny code change

Edited by Xenogis

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Link to comment
Share on other sites

Arrow

Global $edge
Func GUICtrlCreateEdge($x, $y, $width, $height, $color)
    $edge= GUICtrlCreateLabel("", $x, $y, $width, $height, 0x1000)
    GUICtrlSetBkColor($edge, $color)
EndFunc

GUICreate("Edge demo", 400, 400)

_GUICtrlCreateEdgeArrow(100,100,5,100,100,0xFFFF00)

GUISetState ( )

While 1
    $get = GUIGetMsg()
    If $get = -3 then Exit
WEnd
    
Func _GUICtrlCreateEdgeBox($x,$y,$width,$height,$color)
    For $n = 0 To $height Step $width
    GUICtrlCreateEdge($x+$n, $y, $width, $width, $color)
    GUICtrlCreateEdge($x, $y+$n, $width, $width, $color)
    GUICtrlCreateEdge($height + $x, $y+$n, $width, $width, $color)
    GUICtrlCreateEdge($x + $n, $height + $y, $width, $width, $color)
    Next
EndFunc

;Pixel like diagonal edge creator
Func _GUICtrlCreateEdgeDiagonal($x,$y,$w,$h,$l,$c,$lr=1)
    If($lr) Then
        For $n = 1 To $l
        GuiCtrlCreateEdge($x+($n*$w),$y-($n*$w),$w,$h,$c)
        Next
    Else
        For $n = 1 To $l
        GuiCtrlCreateEdge($x+($n*$w),$y+($n*$w),$w,$h,$c)
        Next
    EndIf
 EndFunc
 
Func _GUICtrlCreateEdgeArrow($x,$y,$w,$h,$l,$c)
    For $n = 0 To $l Step $w
        GUICtrlCreateEdge($x+$n, $y, $w, $w, $c)
        GUICtrlCreateEdge($x + $n, $h + $y, $w, $w, $c)
    Next
    _GUICtrlCreateEdgeDiagonal($x+$l,$y,$w,$w,$l/10,$c,0)
    _GUICtrlCreateEdgeDiagonal($x+$l,$y+$l,$w,$w,$l/10,$c)
    _GUICtrlCreateEdgeDiagonal($x,$y,$w,$w,$l/10,$c,0)
    _GUICtrlCreateEdgeDiagonal($x,$y+$l,$w,$w,$l/10,$c)
EndFunc

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

cool :)

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Link to comment
Share on other sites

nothing big... just a little frame :)

Global $edge
Func GUICtrlCreateEdge($x, $y, $width, $height, $color)
    $edge= GUICtrlCreateLabel("", $x, $y, $width, $height, 0x1000)
    GUICtrlSetBkColor($edge, $color)
EndFunc

GUICreate("Edge demo", 200, 200)

GUICtrlCreateEdge(1, 1, 10, 195, 0x00FF00)
GUICtrlCreateEdge(1, 1, 200, 10, 0x00FF00)
GUICtrlCreateEdge(190, 10, 10, 195, 0x00FF00)
GUICtrlCreateEdge(1, 190, 200, 10, 0x00FF00)

GUISetState()

While 1
    $get = GUIGetMsg()
    If $get = -3 then Exit
WEnd
FootbaG
Link to comment
Share on other sites

triangle and square

Global $edge
Func GUICtrlCreateEdge($x, $y, $width, $height, $color)
    $edge= GUICtrlCreateLabel("", $x, $y, $width, $height, 0x1000)
    GUICtrlSetBkColor($edge, $color)
EndFunc

GUICreate("Edge demo", 400, 400)
GUISetState ( )

;Square
_GUICtrlCreateEdgeBox(100,100,5,100,0xFFFF00)
;Square (end)

;Triangle
_GUICtrlCreateEdgeDiagonal(5,50,5,5,9,0x00FF00)
_GUICtrlCreateEdgeLine(0,50,19,5,0x00FF00)
_GUICtrlCreateEdgeDiagonal(45,0,5,5,9,0x00FF00,0)
;Triangle (end)

While 1
    $get = GUIGetMsg()
    If $get = -3 then Exit
WEnd
    
;Pixel like diagonal edge creator
Func _GUICtrlCreateEdgeDiagonal($x,$y,$w,$h,$l,$c,$lr=1)
    If($lr) Then
        For $n = 1 To $l
        GuiCtrlCreateEdge($x+($n*$w),$y-($n*$w),$w,$h,$c)
        Next
    Else
        For $n = 1 To $l
        GuiCtrlCreateEdge($x+($n*$w),$y+($n*$w),$w,$h,$c)
        Next
    EndIf
EndFunc

Func _GUICtrlCreateEdgeLine($x,$y,$w,$h,$c)
    For $n = 1 To $w
        GuiCtrlCreateEdge($x+($n*$h),$y,$h,$h,$c)
    Next
EndFunc

Func _GUICtrlCreateEdgeVLine($x,$y,$w,$h,$c)
    For $n = 1 To $w
        GuiCtrlCreateEdge($x,$y+($n*$h),$h,$h,$c)
    Next
EndFunc

Func _GUICtrlCreateEdgeBox($x,$y,$width,$height,$color)
    For $n = 0 To $height Step $width
    GUICtrlCreateEdge($x+$n, $y, $width, $width, $color)
    GUICtrlCreateEdge($x, $y+$n, $width, $width, $color)
    GUICtrlCreateEdge($height + $x, $y+$n, $width, $width, $color)
    GUICtrlCreateEdge($x + $n, $height + $y, $width, $width, $color)
    Next
EndFunc

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

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