打印本文 打印本文 关闭窗口 关闭窗口
用VB.net制作一个小程序(2)
作者:武汉SEO闵涛  文章来源:敏韬网  点击数3091  更新时间:2009/4/23 19:01:39  文章录入:mintao  责任编辑:mintao
bsp;       ''''

        Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Bitmap)

        Me.PictureBox1.Location = New System.Drawing.Point(208, 120)

        Me.PictureBox1.Name = "PictureBox1"

        Me.PictureBox1.Size = New System.Drawing.Size(288, 208)

        Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage

        Me.PictureBox1.TabIndex = 6

        Me.PictureBox1.TabStop = False

        Me.PictureBox1.Visible = False

        ''''

        ''''Form1

        ''''

        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)

        Me.ClientSize = New System.Drawing.Size(528, 350)

        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.PictureBox1, Me.Label4, Me.Label3, Me.Label2, Me.Label1, Me.Button2, Me.Button1})

        Me.Name = "Form1"

        Me.Text = "Form1"

        Me.ResumeLayout(False)

 

    End Sub

 

#End Region

 

    Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click

    End Sub

 

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        End

    End Sub

 

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        PictureBox1.Visible = False  ''''隐藏图片

        ''''Rnd函数生成0到1之间的随机数(带有一个小数点和几个小数位),Int函数将这几个数乘以10

        ''''后在乘以10后再四舍五入得到一个整数,这样就产生了0到9的随机整数.

        Label1.Text = CStr(Int(Rnd() * 10)) ''''选择数字

        Label2.Text = CStr(Int(Rnd() * 10))

        Label3.Text = CStr(Int(Rnd() * 10))

        ''''如果人一个标题为7则显示图片

        If (Label1.Text = "7") Or (Label2.Text = "7") Or (Label3.Text = "7") Then

            PictureBox1.Visible = True

            Beep()

        End If

    End Sub

End Class

上一页  [1] [2] [3] 

打印本文 打印本文 关闭窗口 关闭窗口