圖片框中動畫

來源:互聯網
上載者:User

一個網友要我做的,一直沒有和他碰到,所以一直沒有給他。感到很抱歉。技術含量不高,有待後人改進。螢幕比較閃,抖動厲害。。。

介面如下:介面圖 http://blog.csdn.net/images/blog_csdn_net/huyoo/60597/o_pr.gif

代碼如下:

 Dim startPoint As Integer
Dim ar(250) As Double

Private Sub Command1_Click()

Timer1.Enabled = False

End Sub

Private Sub Form_Load()
startPoint = Picture1.Width - 20
Dim intTemp As Integer
For i = 1 To UBound(ar)
ar(i) = Rnd(Now()) * 100
Next i
End Sub

Private Sub Timer1_Timer()
startPoint = startPoint - 1
VCenterY = Picture1.Height / 2

'利用定時器周期性地讀取

'Dim tmp As Variant ' CPU資源佔用狀況參數
'tmp = GetUSBData '獲得資料數組
Me.Caption = App.Title & "   " & FormatPercent(tmp / 100) '
'在表單標題列用百分比數字形式反映

'Sum = Sum + tmp '累加統計
'Index = Index + 1 '次數統計
'Avg = Int(Sum / Index) '求平均值
Picture1.Cls '清除圖示內容
Picture1.Line (0, VCenterY)-(Picture1.Width, VCenterY), &HBF&

Picture1.Line (startPoint, VCenterY)-(startPoint, ar(1)), &HBF&

For i = 1 To UBound(ar) - 1
Debug.Print startPoint, ar(i)
Picture1.Line (startPoint + i, ar(i))-(startPoint + i + 1, ar(i + 1)), &HBF&
Next i

End Sub

Private Function GetUSBData() As Variant

End Function

如下:運行時

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.