我用picturebox的Circle方法,画一个飞转的滚轴,画了大小11个圆圈,添充了背景色(fillcolor)。
问题是:只要把timer的频率加快,就会出现抖动。
我认为是用的绘图方法太多,谁知道这个问题怎么解决阿???????????、
BOW

解决方案 »

  1.   

    可以这样做
    1)建立一个picture1(0),autoredraw=true,然后根据需要load多个picture(i)
    2)设置后面的visible=false
    3)把每个picture上画上相应的图形
    4)在timer中bitblt后面的picture。
      

  2.   

    VERSION 5.00
    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
      

  3.   

    先在内存里把图形画好了再StretchBlt到目标图片框去。