一个半径为1000,圆心在(2000,2000)处的圆,还有一个imgroll的图片在圆上(圆的线上),如何让这个图片每一秒围绕圆绕一圈!谢谢了!顺便再问下,一个imgball这样的图片,让它从左到右的移动,可以在tmrmove时间控件下这样写:tmrmove.Interval = 10
imgball.left = imgball.left + 14.9可是这有一个明显的缺点,那就是感到闪烁,不太美观,哪位大哥有移动图片不闪烁的好方法分享下啊?
imgball.left = imgball.left + 14.9可是这有一个明显的缺点,那就是感到闪烁,不太美观,哪位大哥有移动图片不闪烁的好方法分享下啊?
Dim i%
Private Sub Command1_Click()
Timer1.Enabled = True
Shape1.Visible = True
End SubPrivate Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 100
Shape1.Visible = False
End SubPrivate Sub Timer1_Timer()
Circle (2000, 2000), 1000, vbRed
i = i + 1
If i = 60 Then i = 0
Shape1.Move (2000 - 1000 * Cos(i * pi / 30)) - Shape1.Height / 2, (2000 - 1000 * Sin(i * pi / 30)) - Shape1.Height / 2
End Sub
不闪做不到……
Image移动确实会闪m 但非做不到, 不闪的方法至少三种,最简单的采用 PictureBox而非Image, 使用API GdiTransparentBlt可以将PictureBox背景透明如同Image的效果.
'X2 Y2是小圆的圆心座标
'Radius是半径
'Angle角度 0--360度Dim X1&, Y1&, X2&, Y2&, Radius&, Angle&
Const π As Single = 3.14159127
Private Sub Form_Load()
Me.BackColor = QBColor(0)
Me.AutoRedraw = True
Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
X1 = Me.ScaleWidth \ 2: Y1 = Me.ScaleHeight \ 2
Radius = 1000: Angle = 360
Timer1.Interval = 20: Timer1.Enabled = False
End SubPrivate Sub Form_Click()
Timer1.Enabled = True
End SubPrivate Sub Timer1_Timer()
Me.Cls
Me.FillStyle = 1
Me.ForeColor = RGB(255, 255, 0)
Me.Circle (X1, Y1), Radius
Me.FillColor = RGB(0, 255, 0)
Me.FillStyle = 0
X2 = X1 + (Radius * Sin(Angle * (π / 180)))
Y2 = Y1 + (Radius * Cos(Angle * (π / 180)))
Me.Circle (X2, Y2), 100
Angle = IIf(Angle - 1 <= 0, 360, Angle - 1)
End Sub
Const pi = 3.1415926
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Me.AutoRedraw = True
Me.Width = Me.Height
Me.ScaleMode = vbTwips
Scale (-Me.Width / 2, -Me.Height / 2)-(Me.Width / 2, Me.Height / 2)
Timer1.Enabled = False
Timer1.Interval = 100
Shape1.Left = -1000
Shape1.Top = -1000
Shape1.Width = 2000
Shape1.Height = 2000
Shape1.BorderColor = vbRed
Me.Caption = ""
End SubPrivate Sub Timer1_Timer()
Static i As Single
i = i + 0.01
Debug.Print i
Me.Cls
If i > 2 Then i = 0
Circle (1000 * Sin(i * pi), 1000 * Cos(i * pi)), 100, vbRed
Me.FillColor = vbRed
Me.FillStyle = 0
End Sub