1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
Option Explicit
Private cy As Integer
Private cx As Integer
Private ancY As Single
Private ancx As Single
Private diametre As Integer
Private Sub Form_Activate()
Me.ScaleMode = vbPixels
With Picture1
.ScaleMode = vbPixels
.AutoRedraw = True
.BackColor = vbWhite
End With
Picture1.Move Me.ScaleWidth / 4, Me.ScaleHeight / 4, Me.ScaleWidth / 4, Me.ScaleWidth / 4
cx = Picture1.ScaleWidth / 2
cy = Picture1.ScaleHeight / 2
diametre = cx * 0.95
Picture1.Circle (cx, cy), diametre, vbBlue
HScroll1.Move Picture1.Left, Picture1.Top + Picture1.ScaleHeight, Picture1.ScaleWidth
HScroll1.Min = 90
HScroll1.Max = -90
End Sub
Private Sub HScroll1_Change()
HScroll1_Scroll
End Sub
Private Sub HScroll1_Scroll()
Picture1.Cls
Picture1.DrawWidth = 1
Picture1.Circle (cx, cy), diametre, vbBlue
Dim pi As Double, toto As Double
pi = 4 * Atn(1)
toto = (-HScroll1.Value / 180) * pi
ancY = cy + Sin(toto - (0.5 * pi)) * diametre
ancx = cx + Cos(toto - (0.5 * pi)) * diametre
Picture1.DrawWidth = 3
Picture1.Line (cx, cy)-(ancx, ancY)
End Sub |
Partager