'newcyc4 Nov 2002 'Partly inspired by discussions of cycloids et al- and a use found for word$()... 'Thanks to Alyce for previous help on spinner controls. nomainwin UDS.SETBUDDYINT = hexdec( "2") UDS.ARROWKEYS = hexdec( "20") UDS.ALIGNRIGHT = hexdec( "4") calldll #comctl32, "InitCommonControls", re as void UpperLeftX = 20 UpperLeftY = 20 WindowWidth = 640 WindowHeight = 480 f1 =10 factor =0.9998 lw =4 chosen$ ="128 56 23" chosen2$ ="245 127 240" red =val( word$( chosen$, 1)) blue =val( word$( chosen$, 2)) green =val( word$( chosen$, 3)) factarray$( 0) ="0.99995" factarray$( 1) ="0.9999" factarray$( 2) ="0.9998" factarray$( 3) ="0.9997" factarray$( 4) ="0.9995" factarray$( 5) ="1.0000" factarray$( 6) ="1.0001" factarray$( 7) ="1.0002" graphicbox #c.g1 20, 20, 400, 400 graphicbox #c.g2 590, 48, 20, 94 button #c.b2, "&Quit", [quit] , UL, 540, 400, 40, 26 button #c.b4, "Line Colour", [colourpicker1], UL, 500, 46, 80, 26 button #c.b5, "Back Colour", [colourpicker2], UL, 500, 114, 80, 26 textbox #c.t1, 440, 80, 40, 26 textbox #c.tlab1, 500, 80, 60, 26 textbox #c.t4, 430, 240, 50, 26 textbox #c.tlab4, 500, 240, 60, 26 textbox #c.t5, 430, 280, 50, 26 textbox #c.tlab5, 500, 280, 60, 26 button #c.b4, "Show", [show] , UL, 540, 360, 40, 26 combobox #c.co, factarray$(), [hangabout], 430, 200, 60, 150 textbox #c.ct, 500, 200, 60, 26 open "Hyper- & hypo-cycloids by JHF, November 2002, Ver. newcyc4. " for window_nf as #c #c, "trapclose [quit]" #c.co, "select "; "0.9999" #c.ct "Factor" #c.tlab1 "Line width" #c.tlab4 "Radius 1" #c.tlab5 "Radius 2" #c.g2 "down ; fill " +chosen2$ #c.g1 "fill " +chosen2$ hwndParent = hwnd( #c) hText = hwnd( #c.t1) hText4 = hwnd( #c.t4) hText5 = hwnd( #c.t5) CallDLL #user32, "GetWindowLongA", hwndParent As long, _GWL_HINSTANCE As long, hI As long dwStyle= _WS_CHILD or _WS_VISIBLE or _WS_BORDER or UDS.SETBUDDYINT or UDS.ALIGNRIGHT or UDS.ARROWKEYS calldll #comctl32,"CreateUpDownControl",dwStyle as ulong,0 as long,0 as long,0 as long,_ 0 as long,hwndParent as long,1 as long,hI as long,hText as long,10 as long,1 as long,_ 2 as long,hSpinner as long calldll #comctl32,"CreateUpDownControl",dwStyle as ulong,0 as long,0 as long,0 as long,_ 0 as long,hwndParent as long,1 as long,hI as long,hText4 as long,150 as long,1 as long,_ 120 as long, hSpinner as long calldll #comctl32,"CreateUpDownControl",dwStyle as ulong,0 as long,0 as long,0 as long,_ 0 as long,hwndParent as long,1 as long,hI as long,hText5 as long,50 as long,-50 as long,_ 17 as long,hSpinner as long '#c.g1 "goto 200 200 ; down ; size "; str$( lw) [hangabout] wait [show] angle =0 #c.t1 "!contents? txt$": lw =val( txt$) #c.g1 "size "; str$( lw) #c.t4 "!contents? txt$": r1 =val( txt$) #c.t5 "!contents? txt$": r2 =val( txt$): if r2 =0 then r2 =0.001 #c.g1 "up ; goto 200 "; str$( int( 200 +r1 +2 *r2)); " ; down" #c.co, "contents? t$" factor =val( t$) while angle <628' 100 revs r1 =r1 *factor r2 =r2 *factor angle =angle +0.002 f2 =f1 *r1/r2 x1 =( r1 +r2) *sin( angle *f1) y1 =( r1 +r2) *cos( angle *f1) x2 =r2 *sin( angle *f2) y2 =r2 *cos( angle *f2) x = 200 +x1 +x2 y = 200 +y1 +y2 c1$ ="color " +str$( int( red))+ " "+ str$( int( green))+ " "+ str$( int( blue)) c2$ ="backcolor " +str$( int( red))+ " "+ str$( int( green))+ " "+ str$( int( blue)) #c.g1 c1$ #c.g1 c2$ if red <255 then red =red + .1 if green <255 then green =green + .1 if blue <255 then blue =blue + .1 #c.g1 "goto "; str$( x); " "; str$( y) lw =lw *factor #c.g1 "size "; str$( 1 +lw) scan wend #c.g1 "flush" wait [colourpicker1] colordialog color$, chosen$ #c.g1 "color "; chosen$ #c.g2 "color "; chosen$ red =val( word$( chosen$, 1)) blue =val( word$( chosen$, 2)) green =val( word$( chosen$, 3)) #c.t1 "!contents? txt$": lw =val( txt$) #c.g1 "size "; str$( lw) #c.g2 "size "; str$( lw); " ; down" #c.g2 "line 10 5 10 85" wait [colourpicker2] colordialog color$, chosen2$ #c.g1 "fill "; chosen2$ #c.g2 "fill "; chosen2$ #c.g2 "line 10 5 10 85" wait [quit] #c.g1 "getbmp epicycle 0 0 400 400" fn$ ="epicycle" +str$( int(999 *rnd(1))) +".bmp" bmpsave "epicycle", fn$ con$ ="Are you sure you want to QUIT? Graphic saving as " +fn$ confirm con$; answer$ if answer$ = "no" then #c.g1 "fill "; chosen2$ #c.g1 "flush" red =val( word$( chosen$, 1)) blue =val( word$( chosen$, 2)) green =val( word$( chosen$, 3)) wait end if close #c end