vb.net圣经带快捷键,用原装的数据库

vbnet 复制代码
'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
相关推荐
问道飞鱼10 分钟前
【前端知识】强大的js动画组件anime.js
开发语言·前端·javascript·anime.js
k093311 分钟前
vue中proxy代理配置(测试一)
前端·javascript·vue.js
傻小胖13 分钟前
React 脚手架使用指南
前端·react.js·前端框架
中草药z17 分钟前
【Spring】深入解析 Spring 原理:Bean 的多方面剖析(源码阅读)
java·数据库·spring boot·spring·bean·源码阅读
地球资源数据云18 分钟前
全国30米分辨率逐年植被覆盖度(FVC)数据集
大数据·运维·服务器·数据库·均值算法
程序员海军25 分钟前
2024 Nuxt3 年度生态总结
前端·nuxt.js
m0_7482567835 分钟前
SpringBoot 依赖之Spring Web
前端·spring boot·spring
Ahern_1 小时前
Oracle 普通表至分区表的分区交换
大数据·数据库·sql·oracle
web135085886351 小时前
前端node.js
前端·node.js·vim
m0_512744641 小时前
极客大挑战2024-web-wp(详细)
android·前端