小Insect的VB学习历程(2)。

来源:互联网 发布:淘宝美工日常工作内容 编辑:程序博客网 时间:2024/06/06 18:51

经过insect的一番苦心钻眼苹果,之后终于得到了点结果,除了可爱的肚肚fat了一些外突然感觉自己的脑袋有些聪明了,于是虫子现在才明白为什么牛顿才能发现万有引力,原来功劳全部都在苹果身上.如此重大发现给了虫子无比的信心.哈哈^_^

@#$@#&*$@……

好了不叽歪虫子语言了。反正再怎么叽歪,虫子的思想永远是简单的。

虫子的任务终于完成了。代码如下,主要是利用一个picturebox,和一个timer控件在窗体上实现了动态加载效果。如果你不想写load过程的话,这个动态窗体是一个不错的选择。

 

Public Class Form1


    Private counter As Integer
    Private hh As Integer
    Private ww As Integer
    Private op As Integer
    Dim a As Integer
    Dim b As Integer
    Dim c As Double

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        counter = 0
        hh = PictureBox1.Height
        ww = PictureBox1.Width
        op = 1
        a = 0
        b = 0
        c = 0
        Timer1.Interval = 10
        Timer1.Enabled = True
    End Sub

    Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
       
        If counter <= 80 Then
            counter = counter + 1

            Me.Opacity = c
            PictureBox1.Size = New System.Drawing.Size(a, b)
            a = a + (hh / 80)
            b = b + (ww / 80)
            c = c + (op / 80)
        Else
            Timer1.Enabled = False
            counter = 0
        End If
    End Sub


End Class 

 

 

原创粉丝点击