Jump to content

Graphic Help


Recommended Posts

i have this:

Posted Image

GuiCtrlCreateGraphic(220, 50, 100,100)
GUICtrlSetBkColor(-1,0xffffff)
GUICtrlSetColor(-1,0)

GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x005000,0x005000)
GUICtrlSetGraphic(-1,$GUI_GR_ELLIPSE, 10,24, 80,30)
GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x005000,0x005000)
GUICtrlSetGraphic(-1,$GUI_GR_ELLIPSE, 10,27, 80,30)
GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x005000,0x005000)
GUICtrlSetGraphic(-1,$GUI_GR_ELLIPSE, 10,29, 80,30)
GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x008000,0x008000)
GUICtrlSetGraphic(-1,$GUI_GR_ELLIPSE, 10,20, 80,30)

..and i need this:

Posted Image (ms painted!)

can any1 help?

Link to comment
Share on other sites

Ok, I'll work with a flat pie first, then I'll go look up some of my translation functions, then come back to you.

FLAT VERSION:(Demo of 2 methods)

#include <GUIConstants.au3>
GUICreate("zzz", 500, 500)
GUICtrlCreateGraphic(0,0)


;;; Lazy method
GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x005000,0x005000)
;; xlocation, ylocation, radius, startsweep, endsweep
GUICtrlSetGraphic ( -1, $GUI_GR_PIE, 100, 100, 50, 0, 360)
GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0xFFFFFF,0xFFFFFF)
;; xlocation, ylocation, radius, startsweep, endsweep
GUICtrlSetGraphic ( -1, $GUI_GR_PIE, 100, 100, 50, 0,50)
GUICtrlSetGraphic(-1, $GUI_GR_CLOSE)

;;Trig Metod 3
GUICtrlCreateGraphic(0,0)
GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x005000,0x005000)
;; x,y,w,h
GUICtrlSetGraphic ( -1, $GUI_GR_ELLIPSE, 150, 50, 100, 100)
GUICtrlSetGraphic(-1, $GUI_GR_CLOSE)
GUICtrlCreateGraphic(100,200)

GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0xFFFFFF,0xFFFFFF)
GUICtrlSetGraphic(-1, $Gui_GR_MOVE, 0,0)
_CreatePieSector(0, 80, 50, +1)

Func _CreatePieSector($start, $end, $radius, $step=+1)
    $degtorad=3.14159265358979/180
    For $i = $start to $end Step $step
        GUICtrlSetGraphic(-1, $GUI_GR_LINE, Cos($i*$degtorad)*$radius, Sin($i*$degtorad)*$radius)
    Next
    GUICtrlSetGraphic(-1, $GUI_GR_CLOSE)
EndFunc

GUICtrlSetData(-1, $GUI_GR_REFRESH)
GUISetState()
while GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd
Exit

#)

Edited by nfwu
Link to comment
Share on other sites

Ahhh!!!! YES!!!!

Completed 3D version:

#include <GUIConstants.au3>
GUICreate("zzz", 500, 500)
GuiCtrlCreateGraphic(220, 50, 100,100)
GUICtrlSetBkColor(-1,0xffffff)
GUICtrlSetColor(-1,0)

GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x005000,0x005000)
GUICtrlSetGraphic(-1,$GUI_GR_ELLIPSE, 10,24, 80,30)
GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x005000,0x005000)
GUICtrlSetGraphic(-1,$GUI_GR_ELLIPSE, 10,27, 80,30)
GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x005000,0x005000)
GUICtrlSetGraphic(-1,$GUI_GR_ELLIPSE, 10,29, 80,30)
GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x008000,0x008000)
GUICtrlSetGraphic(-1,$GUI_GR_ELLIPSE, 10,20, 80,30)
GuiCtrlCreateGraphic(220+10+40, 50+20+15)
GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x888888,0x888888)
_CreatePieSector2(InputBox("Test Demo", "Enter Starting Angle"), InputBox("Test Demo", "Enter Ending Angle"), 40, 15)
Func _CreatePieSector2($start, $end, $rw, $rh, $step=+1)
    $degtorad=3.14159265358979/180
    For $i = $start to $end Step $step
        GUICtrlSetGraphic(-1, $GUI_GR_LINE, Cos($i*$degtorad)*$rw, Sin($i*$degtorad)*$rh)
    Next
    GUICtrlSetGraphic(-1, $GUI_GR_CLOSE)
EndFunc

GUICtrlSetGraphic(-1, $GUI_GR_REFRESH)
GUISetState()
while GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd
Exit

#)

edit: mistake on line 15 of code.

edit: thanks for pointing out my error about GUICtrlSetGraphic(-1, $GUI_GR_REFRESH)

Edited by nfwu
Link to comment
Share on other sites

Works nice. Thanks!

i knew that i had to use pie somehow - the prob was i could only do a flat version (2d) and that wasnt what i wanted :think: now the 3d thingie from nfwu is very nice!

For People who want to use it too:

Replace this line

GUICtrlSetData(-1, $GUI_GR_REFRESH)
on the very end of nfwu's script

with this one

GUICtrlSetGraphic(-1, $GUI_GR_REFRESH)
Edited by forever
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...