???????????????????

???NHK???w?

???Canvas???Xojo???rocanvas???

???Mac?Pages???295??360???
If theNo3<0 Then
theNo3=theNo3+295+50
End If
???
???180/PI???180/PI??57.29???

???URL???
http://gridwindmusic.digiweb.jp/sample_1.html

rocanvas
Class rocanvas Inherits Canvas
rocanvas.MouseDown:
Function MouseDown(X As Integer, Y As Integer) As Boolean If X>0 and X<me.Width and Y>0 and Y<me.Height Then
dx=X
dy=Y
Dim theNo As Double
//???Paint???
//setAngle2???
theNo=Sqrt((Pow(dx-me.Width/2,2)+Pow(dy-me.Height/2,2)))
If me.Height/2>dy Then
setAngle=Acos((me.Width/2-dx)/theNo)-setAngle2
else
setAngle=-Acos((dx-me.Width/2)/-theNo)-setAngle2
End If
me.Invalidate() End If
Return True
End Function
rocanvas.MouseDrag:
Sub MouseDrag(X As Integer, Y As Integer)
//???X?Y???Paint?Invalidate()???
If X>0 and X<me.Width and Y>0 and Y<me.Height Then
dx=X
dy=Y
End If
me.Invalidate()

End Sub
rocanvas.Paint:
Sub Paint(g As Graphics, areas() As REALbasic.Rect)
//rocanvas???Canvas???

Dim theNo1,theNo2,theNo3 As Double
Dim theX,theY,theW As Integer
//???
theW=g.Width/2-10
//???
theX=(g.Width-5)/2
theY=(g.Height-5)/2
g.PenWidth=1
g.PenHeight=1
g.ForeColor=&c88888800
//???dx?dy???
//???Acos???
//???setAngle???
// MouseDown???
theNo1=Sqrt((Pow(dx-g.Width/2,2)+Pow(dy-g.Height/2,2)))
If g.Height/2>=dy Then
theNo2=Acos((g.Width/2-dx)/theNo1)-setAngle

else
theNo2=-Acos((dx-g.Width/2)/-theNo1)-setAngle

End If
//setAngle2???MouseDown???
//???
setAngle2=theNo2
//???
g.FillOval 5,5,g.Width-10,g.Height-10
//???
//???
g.ForeColor=&cFFFFFF00
g.FillOval theX+Floor(theWCos(theNo2)),theY+Floor(theWSin(theNo2)),5,5
//<???Label1???>?Window1?Label1???
//???57.29?180/PI???
//180/PI???
//???
theNo3=Floor(theNo2*57.2957/5)*5 Mod 360
If theNo3<0 Then
theNo3=theNo3+295+50
End If
//???
Window1.Label1.Text=Str(theNo3)

End Sub
//???
dx As Integer
dy As Integer
setAngle As Double
setAngle2 As Double
End Class

Ohshima???

???
???

MURAOKA???

???
???
http://gridwindmusic.digiweb.jp/sample_1.html
???
???

If theNo3<0 Then
theNo3=theNo3+295+50
End If

???

???
If theNo3<0 Then
theNo3=theNo3-theNo3
End If

???
???

???
If theNo3<0 Then
theNo3=theNo3-theNo3
End If

???

???

**** MouseDown ****
Me.GetValue( X, Y )
Me.Invalidate( )
Return True

**** MouseDrag ****
Me.GetValue( X, Y )
Me.Invalidate( )

**** Paint ****
dim x, y As Double
Const PI=3.14159265358979323846264338327950
Dim DEG2RAD As Double // DEG?RAD ???

DEG2RAD = PI / 180

// ???
g.ForeColor = &c333333
g.FillRect( 0, 0, g.Width, g.Height )

// ???
g.ForeColor = &c888888
g.FillOval( 0, 0, g.Width, g.Height )

// ??? COS(x) ? x ?? ???RAD???
// g.Width/2 ???0.9???
// ???g.Width / 2 ???
// ??? x, y ???
x = ( Cos( Me.value * DEG2RAD ) * g.Width/2 * 0.9 ) + g.Width / 2 - 5
y = ( Sin( Me.value * DEG2RAD ) * g.Height/2 * 0.9 ) + g.Height / 2 - 5

// ???
g.ForeColor = &cFFFFFF
g.FillOval( x, y, 10, 10 )

// ???
Window1.Label1.Text = Str( Me.value )

**** ??? GetValue( X As Integer, Y As Integer ) ****
Dim RAD2DEG As Double // RAD?DEG ???
Const PI=3.14159265358979323846264338327950

RAD2DEG = 180 / PI
// ???
// ???
Me.Value = Atan2( Y - (Me.Height / 2), X - (Me.Width / 2) ) * RAD2DEG

// ??? 360 ???
If Me.value < 0 Then Me.value = Me.value + 360

**** ??? ****
value As Integer // ???

???

MURAOKA???
???

???

Me.Value = Atan2( Y - (Me.Height / 2), X - (Me.Width / 2) ) * RAD2DEG

???Atan2???Paint???
???
???

???
???URL???

???Paint ???
???
???……?
???

???

???
???MURAOKA???

???

???Xojo???Paint???OSX???

???
???

???……?
??? X68000 ???

???
???

???

http://gridwindmusic.digiweb.jp/sample_1.html

TextArea?HTML???

???

???