📄 frmmain.frm
字号:
End
Begin MSComctlLib.ImageList ImageList2
Left = 0
Top = 0
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 64
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 9
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMain.frx":1145
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMain.frx":13D9
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMain.frx":166D
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMain.frx":1901
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMain.frx":1B95
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMain.frx":1E29
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMain.frx":20BD
Key = ""
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMain.frx":2351
Key = ""
EndProperty
BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmMain.frx":25E5
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.StatusBar SBar
Align = 2 'Align Bottom
Height = 255
Left = 0
TabIndex = 9
Top = 6360
Width = 9795
_ExtentX = 17277
_ExtentY = 450
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 4
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
AutoSize = 1
Object.Width = 7182
MinWidth = 7182
Picture = "FrmMain.frx":2879
Text = "知更鸟(Robin)版权所有,2003。"
TextSave = "知更鸟(Robin)版权所有,2003。"
Object.ToolTipText = "知更鸟(Robin)版权所有,2003。"
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Alignment = 1
Object.Width = 7408
MinWidth = 7408
Text = "EMAIL:gen2star@tom.com,电话:13912265004"
TextSave = "EMAIL:gen2star@tom.com,电话:13912265004"
EndProperty
BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Style = 6
Alignment = 1
Object.Width = 1670
MinWidth = 1670
TextSave = "2003-10-31"
EndProperty
BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Style = 5
Alignment = 1
Object.Width = 1086
MinWidth = 1086
TextSave = "8:53"
EndProperty
EndProperty
End
End
Attribute VB_Name = "FrmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim SelectString As String
Private Sub begin_Click()
On Error GoTo wrong
Dim LibName As String
If combo1.ListIndex = -1 Or Text1.Text = "" Or Text1.Text = "" Then
MsgBox "你没有输入查询内容或选择查询项"
Else
Select Case SSTab1.Tab
Case 3
SelectString = "select * from 学籍表 where " & combo1.Text & " like '%" & Text1.Text & "%'"
Adodc1.ConnectionString = Con
Set DataGrid1.DataSource = Adodc1
Adodc1.RecordSource = SelectString
DataGrid1.Visible = True
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
Text3.Text = "很抱歉!没有发现任何记录"
Else
Text3.Text = "共发现" & Adodc1.Recordset.RecordCount & "条记录"
End If
Case 4
If combo1.Text = "姓名" Then
SelectString = "select b.班级,b.学号,b.姓名,a.* from 成绩表 AS a INNER JOIN 学籍表 AS b ON a.考试号 = b.考试号 where b.姓名 like '%" & Text1.Text & "%' order by a.总分 desc"
Else
SelectString = "select b.班级,b.学号,b.姓名,a.* from 成绩表 AS a INNER JOIN 学籍表 AS b ON a.考试号 = b.考试号 where a." & combo1.Text & " like '%" & Text1.Text & "%' order by a.总分 desc"
End If
Adodc1.ConnectionString = Con
Set DataGrid1.DataSource = Adodc1
Adodc1.RecordSource = SelectString
DataGrid1.Visible = True
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
Text3.Text = "很抱歉!没有发现任何记录"
Else
Text3.Text = "共发现" & Adodc1.Recordset.RecordCount & "条记录"
End If
End Select
End If
Exit Sub
wrong:
MsgBox err.Description
End Sub
Private Sub CCount_Click()
FrmCCount.Show
End Sub
Private Sub Check1_Click()
If Check1.Value = 1 Then
DataGrid1.AllowUpdate = True
DataGrid1.AllowDelete = True
Else
DataGrid1.AllowUpdate = False
DataGrid1.AllowDelete = False
End If
End Sub
Private Sub Form_Load()
On Error GoTo err
Me.Caption = App.Title
Left = (Screen.Width - Width) \ 2
Top = (Screen.Height - Height) \ 2 '使窗体居中
Call ResizeInit(Me)
With Adodc1
.ConnectionString = Con.ConnectionString
.CommandType = adCmdText
.RecordSource = "select 班级,班主任,语文,数学,英语,物理,化学,政治,历史,地理,生物 from 分工表"
End With
Adodc1.Refresh
Text3.Text = "共发现" & Adodc1.Recordset.RecordCount & "条记录"
Exit Sub
err:
Call ExecErr(Date, Me.Caption, err.Number, err.Source, err.Description)
End Sub
Private Sub Form_Resize()
Call ResizeForm(Me) '窗体改变时,控件随之变化
Toolbar1.Top = (Frame1.Height - Toolbar1.Height) / 2
Text1.Height = combo1.Height
Text1.Left = combo1.Left + combo1.Width + 60
combo1.Top = Text1.Top
With begin
.Left = Text1.Left + Text1.Width + 120
.Top = Text1.Top
.Height = Text1.Height
.Width = .Height '窗体改变时,调整combol1,beigin按钮的位置,combol1高度保持不变
End With
If Frame1.Top > 200 Then
Toolbar1.Top = Frame1.Top - 150
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
If vbNo = MsgBox("确认退出本应用程序么?", vbYesNo, "退出对话框") Then
Cancel = 1
Exit Sub
End If
'彻底卸载所有窗体并退出程序
ReleaseResource
End Sub
Private Sub SSTab1_Click(PreviousTab As Integer)
On Error GoTo err
Select Case SSTab1.Tab
Case 0
Text3.Text = ""
SelectString = "select 班级,班主任,语文,数学,英语,物理,化学,政治,历史,地理,生物 from 分工表 order by 班级"
Adodc1.ConnectionString = Con.ConnectionString
Set DataGrid1.DataSource = Adodc1
Adodc1.RecordSource = SelectString
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
Text3.Text = "很抱歉!没有发现任何记录"
Else
Text3.Text = "共发现" & Adodc1.Recordset.RecordCount & "条记录"
End If
Case 1
Text3.Text = ""
SelectString = "select * from 学籍表"
Adodc1.ConnectionString = Con.ConnectionString
Set DataGrid1.DataSource = Adodc1
Adodc1.RecordSource = SelectString
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
Text3.Text = "很抱歉!没有发现任何记录"
Else
Text3.Text = "共发现" & Adodc1.Recordset.RecordCount & "条记录"
End If
Case 2
Text3.Text = ""
SelectString = "select b.班级,b.学号,b.姓名,a.* from 成绩表 AS a INNER JOIN 学籍表 AS b ON a.考试号 = b.考试号 order by a.考试性质,a.总分 desc"
Adodc1.ConnectionString = Con.ConnectionString
Set DataGrid1.DataSource = Adodc1
Adodc1.RecordSource = SelectString
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
Text3.Text = "很抱歉!没有发现任何记录"
Else
Text3.Text = "共发现" & Adodc1.Recordset.RecordCount & "条记录"
End If
Case 3
Text1.Text = "关键字"
Text3.Text = ""
With combo1
.Clear
.Text = "请选择类别"
.AddItem "初考证号", 0
.AddItem "姓名", 1
.AddItem "班级", 2
.AddItem "学号", 3
.AddItem "家长姓名", 4
.AddItem "联系电话", 5
.AddItem "计外", 6
End With
DataGrid1.Visible = False
Case 4
Text1.Text = "关键字"
Text3.Text = ""
With combo1
.Clear
.Text = "请选择类别"
.AddItem "姓名", 0
.AddItem "考试号", 1
.AddItem "总分", 2
.AddItem "语文", 3
.AddItem "数学", 4
.AddItem "英语", 5
.AddItem "物理", 6
.AddItem "化学", 7
.AddItem "政治", 8
.AddItem "考试性质", 9
End With
DataGrid1.Visible = False
End Select
Exit Sub
err:
Call ExecErr(Date, Me.Caption, err.Number, err.Source, err.Description)
End Sub
Private Sub SSTab1_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single)
Select Case SSTab1.Tab
Case 3
combo1.Enabled = True
combo1.Enabled = True
Text1.Enabled = True
begin.Enabled = True
begin.Picture = ImageList1.ListImages(3).Picture
Case 4
combo1.Enabled = True
combo1.Enabled = True
Text1.Enabled = True
begin.Enabled = True
begin.Picture = ImageList1.ListImages(3).Picture
Case 0, 1, 2
combo1.Enabled = False
combo1.Enabled = False
Text1.Enabled = False
begin.Enabled = False
DataGrid1.Visible = True
begin.Picture = ImageList1.ListImages(4).Picture '即时改变combol1,begin的状态,当切换到查询时有效
End Select
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
On Error GoTo err
Select Case Button.Index
Case 1
FrmAddFg.Show 1, FrmMain
Case 2
FrmAddJs.Show 1, FrmMain
Case 3
FrmAddXj.Show 1, FrmMain
Case 4
FrmAddCj.Show 1, FrmMain
Case 5
FrmCCount.Show 1, FrmMain
Case 6
FrmDataOut.Show 1, FrmMain
Case 7
FrmChat.Show 1, FrmMain
Case 8
FrmManage.Show 1, FrmMain
Case 9
Dim Scr_hDC As Long
Scr_hDC = GetDesktopWindow()
StartDoc = ShellExecute(Scr_hDC, "Open", App.Path & "\Mydoc.doc", "", "C:\", 1)
StartDoc = ShellExecute(Scr_hDC, "Open", App.Path & "\help.chm", "", "C:\", 1)
End Select
Exit Sub
err:
Call ExecErr(Date, Me.Caption, err.Number, err.Source, err.Description)
End Sub
Private Sub Timer1_Timer()
If MyHotKey(vbKeyF1) Then
Dim Scr_hDC As Long
Scr_hDC = GetDesktopWindow()
StartDoc = ShellExecute(Scr_hDC, "Open", App.Path & "\help.chm", "", "C:\", 1)
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -