這是一個可以讓大家了解自動修改畫布的範例。
原始檔:http://down.gogobox.com.tw/t2329175/b0dq2
Public Class Form1
Dim a, b, c As Double
Dim f As Brush
Dim g As Graphics
Dim ee As System.Windows.Forms.PaintEventArgs
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
ee = e
Dim g As Graphics = CreateGraphics()
g.Clear(Color.White)
Dim font As Font = New Font("標楷體", 14)
Dim brush As SolidBrush = New SolidBrush(Color.FromArgb(a, b, c))
g.DrawString("Visual Basic2005 程式設計範例教本", font, brush, 25, 30)
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Randomize()
a = Int(Rnd() * 255 + 1)
b = Int(Rnd() * 255 + 1)
c = Int(Rnd() * 255 + 1)
Call Form1_Paint(sender, ee)
End Sub
End Class
全站熱搜
留言列表