图片播放器,其中有获取文件夹和所以文件的代码

by admin on 2020年1月20日

打小地鼠

    Private Sub ToolStripLabel3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripLabel3.Click
        出库.show()
    End Sub

‘3.显示图片

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
a = TextBox1.Text.ToUpper
time += 1
time1 += 1
If time1 < 120 Then
If a = Chr(num) Then
mark += 1
TextBox2.Text = mark
End If
If time = time2 Or a = Chr(num) Then
num = rnd.Next(65, 90)
num1 = leter.Next(0, 10)
If num1 = 1 Or
num1 = 0 Then
Label1.Text = Chr(num)
Label2.Text = “*”
Label3.Text = “*”
Label4.Text = “*”
Label5.Text = “*”
Label6.Text = “*”
Label7.Text = “*”
Label8.Text = “*”
Label9.Text = “*”
If a = (Label1.Text) Then
mark += 1
TextBox2.Text = mark
End If
End If
If num1 = 2 Then
Label2.Text = Chr(num)
Label1.Text = “*”
Label3.Text = “*”
Label4.Text = “*”
Label5.Text = “*”
Label6.Text = “*”
Label7.Text = “*”
Label8.Text = “*”
Label9.Text = “*”
If a = (Label2.Text) Then
mark += 1
TextBox2.Text = mark
End If
End If
If num1 = 3 Then
Label3.Text = Chr(num)
Label2.Text = “*”
Label1.Text = “*”
Label4.Text = “*”
Label5.Text = “*”
Label6.Text = “*”
Label7.Text = “*”
Label8.Text = “*”
Label9.Text = “*”
If a = (Label3.Text) Then
mark += 1
TextBox2.Text = mark
End If
End If
If num1 = 4 Then
Label4.Text = Chr(num)
Label2.Text = “*”
Label3.Text = “*”
Label1.Text = “*”
Label5.Text = “*”
Label6.Text = “*”
Label7.Text = “*”
Label8.Text = “*”
Label9.Text = “*”
If a = (Label4.Text) Then
mark += 1
TextBox2.Text = mark
End If
End If
If num1 = 5 Then
Label5.Text = Chr(num)
Label2.Text = “*”
Label3.Text = “*”
Label4.Text = “*”
Label1.Text = “*”
Label6.Text = “*”
Label7.Text = “*”
Label8.Text = “*”
Label9.Text = “*”
If a = (Label5.Text) Then
mark += 1
TextBox2.Text = mark
End If
End If
If num1 = 6 Then
Label6.Text = Chr(num)
Label2.Text = “*”
Label3.Text = “*”
Label4.Text = “*”
Label5.Text = “*”
Label1.Text = “*”
Label7.Text = “*”
Label8.Text = “*”
Label9.Text = “*”
If a = (Label6.Text) Then
mark += 1
TextBox2.Text = mark
End If
End If
If num1 = 7 Then
Label7.Text = Chr(num)
Label2.Text = “*”
Label3.Text = “*”
Label4.Text = “*”
Label5.Text = “*”
Label6.Text = “*”
Label1.Text = “*”
Label8.Text = “*”
Label9.Text = “*”
If a = (Label7.Text) Then
mark += 1
TextBox2.Text = mark
End If
End If
If num1 = 8 Then
Label8.Text = Chr(num)
Label2.Text = “*”
Label3.Text = “*”
Label4.Text = “*”
Label5.Text = “*”
Label6.Text = “*”
Label7.Text = “*”
Label1.Text = “*”
Label9.Text = “*”
If a = (Label8.Text) Then
mark += 1
TextBox2.Text = mark
End If
End If
If num1 = 9 Or
num1 = 10 Then
Label9.Text = Chr(num)
Label2.Text = “*”
Label3.Text = “*”
Label4.Text = “*”
Label5.Text = “*”
Label6.Text = “*”
Label7.Text = “*”
Label8.Text = “*”
Label1.Text = “*”
If a = (Label9.Text) Then
mark += 1
TextBox2.Text = mark
End If
End If
time = 0
End If
TextBox1.Clear()
TextBox1.Focus()
End If
If time1 = 120 Then
Timer1.Enabled = False
MsgBox(“您的得分为:” & mark, , “打小地鼠”)
time1 = 0
time = 0
End If
Label10.Text = (120 – time1) & “s”
End Sub

    Dim myreader =
SqlCommand1.ExecuteReader()

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

End Class

    End Sub

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Timer1.Enabled = False
End Sub

    Private Sub ToolStripLabel8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripLabel8.Click
        End
    End Sub

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

Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
RadioButton1.Checked = False
RadioButton2.Checked = False
time2 = 1
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True
TextBox1.Clear()
TextBox2.Clear()
TextBox1.Focus()
time = 0
time1 = 0
End Sub

    Private Sub ToolStripLabel7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripLabel7.Click
        关于.show()
    End Sub

PictureBox1.AutoSize = True

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Enabled = False
MsgBox(“您的得分为:” & mark, , “打小地鼠”)
time = 0
time1 = 0
TextBox2.Clear()
Timer1.Enabled = False
End Sub

其他信息: 创建窗体时出错。有关详细信息,请参阅
Exception.InnerException。错误为: 未将对象引用设置到对象的实例。
界面log1代码如下:
Imports System.Data
Imports System.Data.SqlClient
Imports
System.Data.SqlClient.SqlConnection
Imports
System.Data.SqlClient.SqlDataReader
Public Class log1
    Inherits
System.Windows.Forms.Form

Public 全局的文件数量 As Integer

     我是一个菜鸟,对程序还是不怎么了解,做了一个小游戏大家参考参考

大家好,我在做vb.net编程时,出现了这样一个问题,不知道该怎么办,我是学生,是新手,请懂的人帮帮我,谢谢了!!!

Imports System.Text.RegularExpressions ‘正则表达式

 

    Private Sub ToolStripLabel2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripLabel2.Click
        用户管理.Show()
    End Sub

Button2.Visible = True

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Timer1.Enabled = True
End Sub

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

Me.Width = 558

Public Class 打小地鼠
Dim rnd As
New Random()
Dim leter As New
Random()
Dim num, num1, time, time1, mark
As Integer
Dim a As String
Dim time2 As Integer = 2
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
RadioButton2.Checked = False
RadioButton3.Checked = False
time2 = 3
End Sub

 

Me.MaximumSize = a

这是我做的一个类似打地鼠的小游戏,大家多提意见,也挺好玩的图片 1这是图片

    End Sub

全局的计数器 = 全局的计数器 + 1

    Private Sub ToolStripLabel4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripLabel4.Click
        入库.show()
    End Sub

End If

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim main As New
Form()
        If TextBox1.Text = “” Or
TextBox2.Text = “” Or ComboBox1.Text = “” Then
            MsgBox(“请输入相应信息!”, MsgBoxStyle.Information, “超市管理系统”)

OpenFileDialog1.RestoreDirectory = True

    Function user() As Boolean
        SqlConnection1.Open()
        SqlCommand1 = New
SqlCommand(“SELECT * FROM 用户信息 WHERE 用户名=
‘” & TextBox1.Text & “‘”,
SqlConnection1)
        myreader = SqlCommand1.ExecuteReader()
        Dim TempString As String
        Dim type As String
        While myreader.Read
            TempString = myreader(“用户密码”)
            type = myreader(“用户类型”)
        End While
        SqlConnection1.Close()
        myreader.Close()
        SqlCommand1.Dispose()
        If TextBox2.Text =
TempString And ComboBox1.Text = type
Then
            Return True
        Else
            If TextBox2.Text
<> TempString And
ComboBox1.Text <> type Then
                Return False
            End If
        End If
    End Function

‘If InStr(1, 全局的文件名称(全局的计数器), “.bmp”, 1) Or InStr(1,
全局的文件名称(全局的计数器), “.jpg”, 1) _

        ElseIf TextBox1.Text
<> “” And TextBox2.Text <> “” And
ComboBox1.Text <> “” And user() = True Then
            main.Show()
        Else
            MsgBox(“密码不正确或管理员信息不匹配!”)
        End If
    End Sub

‘If InStr(1, 全局的文件名称(全局的计数器), “.bmp”, 1) Or InStr(1,
全局的文件名称(全局的计数器), “.jpg”, 1) _

界面 main代码如下:
Public Class main
    Inherits
System.Windows.Forms.Form

Else

    Private Sub ToolStripLabel6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripLabel6.Click

Shared x As Integer = 1300

    Private Sub ToolStripLabel1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripLabel1.Click
        Dim log1 As New
Form()
        log1.Show()
        Me.Close()

PictureBox1.SizeMode = PictureBoxSizeMode.Zoom

未处理的“System.InvalidOperationException”类型的异常出现在 w.exe 中。

Button1.Visible = True

    Private Sub main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If log1.ComboBox1.Text =
“普通员工” Then
            ToolStripLabel2.Enabled = False
            ToolStripLabel3.Enabled = False
            ToolStripLabel4.Enabled = False
            用户报表ToolStripMenuItem.Enabled = False
        End If
        If log1.ComboBox1.Text =
“普通管理员” Then
            ToolStripLabel2.Enabled = False
            用户报表ToolStripMenuItem.Enabled = False
        End If
  
    End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick

    Private Sub ToolStripLabel5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripLabel5.Click
        查询.show()
    End Sub

PictureBox1.Image = Image.FromFile(全局的文件名称(0))

End Class

‘打开文件选项 使用的openfiledialog控件

‘Or InStr(1, 全局的文件名称(全局的计数器), “.png”, 1) Then

Me.FolderBrowserDialog1.ShowDialog() ‘打开文件夹选项框

‘Or InStr(1, 全局的文件名称(全局的计数器), “.png”, 1) Then

TextBox1.Visible = False

pic.Dispose()

Me.Height = 349

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click

Me.AutoSize = True

‘打开文件夹选项 使用的FolderBrowserDialog控件

Dim 文件夹名称 As String =
文件夹名称路径.Substring(文件夹名称路径.LastIndexOf(“”) + 1)
‘得到文件夹名称

Button3.Visible = False

‘1.遍历文件夹中所有可播放图片

OpenFileDialog1.FilterIndex = 1 ‘
获取或设置文件对话框中当前选定筛选器的索引

MsgBox(“文件夹中不包含任何文件或只有文件夹存在!”)

End Sub

Public 全局的文件名称() As String

Dim 文件夹名称路径 As String = FolderBrowserDialog1.SelectedPath
‘获得文件夹路径

TextBox1.Visible = True

全局的文件数量 = 文件数量

OpenFileDialog1.ShowDialog() ‘打开文件选择框

End If

End While

Dim 文件数量 As Integer = 全局的文件名称.Length

Label2.Visible = True

Else

‘播放多张图片的解决方案

OpenFileDialog1.Title = “打开文件” ‘设置对话框标题

Label1.Visible = True

Button3.Visible = True

Shared y As Integer = 700

End Structure

End If

Dim a As Size

End Sub

Dim 文件名称 As String = OpenFileDialog1.FileName ‘得到选择的文件

While 计数器 < 文件数量

‘2.将所有图片数据保存或者一张张读取播放

Public Class 图片播放器

Dim 计数器 As Integer = 0

Public Structure a

If 文件数量 > 0 Then

End Sub

If 全局的计数器 < 全局的文件数量 Then

‘End If

PictureBox1.Image = pic

MsgBox(“没有输入有效数字,请重新输入!”)

End Class

Dim 全局的文件名称() As String =
System.IO.Directory.GetFiles(文件夹名称路径)

‘OpenFileDialog1.Filter = “”

Label2.Text = “毫秒”

End Sub

If IsNumeric(TextBox1.Text) = True Then ‘如果是数字则通过

Label1.Visible = False

Label2.Visible = False

Public 全局的计数器 As Integer = 0

Label1.Text = “图片数量:” & 文件数量 & “张  播放间隔:”

PictureBox1.Image = Image.FromFile(文件名称)

Private Sub 图片播放器_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

计数器 = 计数器 + 1

Dim pic As New Bitmap(全局的文件名称(全局的计数器))

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图