我用picturebox的Circle方法,画一个飞转的滚轴,画了大小11个圆圈,添充了背景色(fillcolor)。
问题是:只要把timer的频率加快,就会出现抖动。
我认为是用的绘图方法太多,谁知道这个问题怎么解决阿???????????、
BOW
问题是:只要把timer的频率加快,就会出现抖动。
我认为是用的绘图方法太多,谁知道这个问题怎么解决阿???????????、
BOW
解决方案 »
- VB中对XML的读取是怎样的?我是VB新手,求指教
- 求平均值,并且让最大值,最小值输入框字体颜色发生变化!
- 请大家帮我看看错在哪里?
- 请问如何用VB6编写一个通过互联网发送短消息的小程序?
- 求VB版的 Windows Shell Extension 资料(要中文的)。
- 怎样判断一个控件的类型?
- VB中如何使用用户控件(User Control)
- 请问高手关于数据库程序兼容性问题!
- 为什么我运行编译好的exe文件后Windows任务管理器里面老是有个“工程1”的进程不能结束???
- 紧急求助!!!我使用ADO为什么连不上数据库?
- VB & Delphi
- 经常在用绘图api时,搞不清autoredraw的属性应为什么,哪们可以说一下?
1)建立一个picture1(0),autoredraw=true,然后根据需要load多个picture(i)
2)设置后面的visible=false
3)把每个picture上画上相应的图形
4)在timer中bitblt后面的picture。
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3570
ClientLeft = 60
ClientTop = 345
ClientWidth = 3000
LinkTopic = "Form1"
ScaleHeight = 3570
ScaleWidth = 3000
StartUpPosition = 3 'Windows Default
Begin VB.Timer t
Left = 105
Top = 3045
End
Begin VB.CommandButton c
Caption = "Command1"
Height = 420
Left = 735
TabIndex = 1
Top = 3075
Width = 1395
End
Begin VB.PictureBox p
Height = 2955
Index = 0
Left = 0
ScaleHeight = 2895
ScaleWidth = 2940
TabIndex = 0
Top = 15
Width = 3000
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Const pi = 3.1415926
Dim g__index As Integer
Private Sub c_Click()
If LCase(c.Caption) = "start" Then
t.Enabled = True
c.Caption = "stop"
Else
t.Enabled = False
c.Caption = "start"
End If
End SubPrivate Sub Form_Load()
p(0).AutoRedraw = True
p(0).BackColor = vbWhite
c.Caption = "start"
t.Enabled = False
t.Interval = 50
Dim i As Integer
For i = 1 To 40
Load p(i)
p(i).Visible = False
Next i
For i = 0 To 40
draw i
Next i
End SubPrivate Sub Form_Unload(Cancel As Integer)
Dim i As Integer
For i = 1 To 40
Unload p(i)
Next i
End SubPrivate Sub draw(ByVal angle As Integer)
Dim i As Double
Dim j As Double
Dim x As Double
Dim y As Double
Dim rx As Double
Dim ry As Double
Dim r0 As Double
Dim r1 As Double
rx = p(0).Width / 2
ry = p(0).Height / 2
r0 = 70 * 15
r1 = 20 * 15
For i = 0 To 2 * pi Step pi / 4
For j = 0 To 2 * pi Step pi / 10
x = rx + r0 * Cos(i + (angle / 40) * 2 * pi)
y = ry + r0 * Sin(i + (angle / 40) * 2 * pi)
p(angle).Circle (x + r1 * Cos(j), y + r1 * Sin(j)), 30, RGB(Abs(angle - 20) * 12, Abs(angle - 20) * 12, Abs(angle - 20) * 12)
Next j
Next i
End SubPrivate Sub t_Timer()
Dim w As Long
Dim h As Long
w = p(0).Width / 15
h = p(0).Height / 15
Set p(0).Picture = p(g__index).Image
g__index = g__index + 1
If g__index > 40 Then
g__index = 1
End If
End Sub