'Imports System.Data.SqlServerCe
Imports System.Text.RegularExpressions
Imports System.Data.OleDb
Public Class Form1
Dim jiuyue As String() = {"创", "出", "利", "民", "申", "书", "士", "得", "撒上", "撒下", "王上", "王下", "代上", "代下", "拉", "尼", "斯", "伯", "诗", "箴", "传", "歌", "赛", "耶", "哀", "结", "但", "何", "珥", "摩", "俄", "拿", "弥", "鸿", "哈", "番", "该", "亚", "玛"}
Dim xinyue As String() = {"太", "可", "路", "约", "徒", "罗", "林前", "林后", "加", "弗", "腓", "西", "帖前", "帖后", "提前", "提后", "多", "门", "来", "雅", "彼前", "彼后", "约壹", "约贰", "约叁", "犹", "启"}
Dim tsl As ToolStripLabel = New ToolStripLabel("按f5全屏,esc退出全屏")
Dim msjiuyue As MenuStrip = New MenuStrip()
Dim msxinyue As MenuStrip = New MenuStrip()
Dim rtb As RichTextBox = New RichTextBox()
Dim rtb2 As RichTextBox = New RichTextBox()
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
rtb.Dock = DockStyle.Fill
rtb.Font = New Font("黑体", 70, FontStyle.Bold)
rtb.BackColor = Color.Black
rtb.ReadOnly = True
For i As Integer = 0 To jiuyue.Length - 1
Dim tsb As ToolStripButton = New ToolStripButton(jiuyue(i))
AddHandler tsb.Click, AddressOf tsbClick
If i < 5 Then
tsb.BackColor = Color.Cyan
ElseIf i < 17 Then
tsb.BackColor = Color.Magenta
ElseIf i < 22 Then
tsb.BackColor = Color.Yellow
ElseIf i < 39 Then
tsb.BackColor = Color.Pink
End If
msjiuyue.Items.Add(tsb)
Next i
For i As Integer = 0 To xinyue.Length - 1
Dim tsb As ToolStripButton = New ToolStripButton(xinyue(i))
AddHandler tsb.Click, AddressOf tsbClick
If i < 4 Then
tsb.BackColor = Color.Cyan
ElseIf i < 5 Then
tsb.BackColor = Color.Magenta
ElseIf i < 26 Then
tsb.BackColor = Color.Yellow
ElseIf i < 27 Then
tsb.BackColor = Color.Pink
End If
msxinyue.Items.Add(tsb)
Next i
msxinyue.Items.Add(tsl)
Me.WindowState = FormWindowState.Maximized
Me.Controls.Add(msxinyue)
Me.Controls.Add(msjiuyue)
Me.Controls.Add(rtb)
Me.KeyPreview = True '开启键盘监听
AddHandler Me.KeyDown, AddressOf f5escClick
End Sub
Private Sub tsbClick(sender As Object, e As EventArgs)
Dim s As String = CType(sender, ToolStripButton).Text
selecthb(s)
End Sub
Private Sub selecthb(ShortName As String)
Dim s As String = InputBox("输入章数,开始小节,中间用空格分开", "输入章节数,中间用空格间隔", "1 1")
If s = Nothing Then
Return
ElseIf s.Equals("") Then
Return
End If
Dim fenge As String() = s.Split(" ")
If fenge.Length < 2 Then
Return
End If
If Not IsNumeric(fenge(0).Trim()) Or Not IsNumeric(fenge(1).Trim()) Then
Return
End If
Me.rtb.Text = ""
Using con As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=bibleNosound.dat;Persist Security Info=True;Jet OLEDB:Database Password=pasitoldata")
Using cmd As OleDbCommand = New OleDbCommand("select * from bible, bibleid where bible.VolumeSN = bibleid.SN and ShortName = @ShortName and ChapterSN = @ChapterSN and VerseSN >= @VerseSN", con)
cmd.Parameters.AddWithValue("ShortName", ShortName)
cmd.Parameters.AddWithValue("ChapterSN", fenge(0))
cmd.Parameters.AddWithValue("VerseSN", fenge(1))
con.Open()
Using sdr As OleDbDataReader = cmd.ExecuteReader()
Dim i As Integer = 0
While sdr.Read()
If i Mod 3 = 0 Then
Me.rtb.SelectionColor = Color.Cyan
ElseIf i Mod 3 = 1 Then
Me.rtb.SelectionColor = Color.Magenta
Else
Me.rtb.SelectionColor = Color.Yellow
End If
Me.rtb.AppendText(Chr(13) & sdr("ShortName") & ":" & sdr("ChapterSN") & ":" & sdr("VerseSN") & sdr("strjw"))
i += 1
End While
End Using
End Using
End Using
Me.rtb.Select(0, 0)
Me.rtb.Focus()
End Sub
Public Sub sql()
Using con As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=bibleNosound.mdb;Persist Security Info=True")
Using cmd As OleDbCommand = New OleDbCommand("select fullname,shortname,chapterSn,versesn,strjw from bible, bibleid where volumesn = sn", con)
Using oda As OleDbDataAdapter = New OleDbDataAdapter(cmd)
Using dt As DataTable = New DataTable()
oda.Fill(dt)
Dim dgv As DataGridView = New DataGridView()
dgv.Dock = DockStyle.Fill
dgv.DataSource = dt
Me.Controls.Add(dgv)
End Using
End Using
End Using
End Using
End Sub
Private Sub f5escClick(sender As Object, e As KeyEventArgs) '实现监听键盘事件
Dim kc As Keys = e.KeyCode
If kc = Keys.F5 Then
Me.msjiuyue.Visible = False
Me.msxinyue.Visible = False
ElseIf kc = Keys.Escape Then
Me.msjiuyue.Visible = True
Me.msxinyue.Visible = True
End If
End Sub
End Class