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
相关推荐
cwtlw3 分钟前
PhotoShop学习04
学习·ui·photoshop
程序猿阿伟24 分钟前
《打破SQL与AI框架对接壁垒,解锁融合新路径》
数据库·人工智能·sql
点燃大海27 分钟前
MySQL表结构导出(Excel)
java·数据库·python·mysql·spring
꧁坚持很酷꧂40 分钟前
Qt远程连接数据库,注册,登录
开发语言·数据库·qt
加油,旭杏1 小时前
【Redis】服务端高并发分布式结构
数据库·redis·分布式
我是小路路呀1 小时前
vue开始时间小于结束时间,时间格式:年月日时分
前端·javascript·vue.js
虾球xz1 小时前
游戏引擎学习第201天
前端·学习·游戏引擎
我自纵横20231 小时前
JavaScript 中常见的鼠标事件及应用
前端·javascript·css·html·计算机外设·ecmascript
li_Michael_li1 小时前
Vue 3 模板引用(Template Refs)详解与实战示例
前端·javascript·vue.js
excel1 小时前
webpack 核心编译器 十五 节
前端