📄 form8.frm
字号:
VERSION 5.00
Object = "{DAAC6951-59A4-4C08-9D6E-FE3919B64861}#1.0#0"; "FlexCell.ocx"
Begin VB.Form Form8
Caption = "成绩统计图表"
ClientHeight = 5340
ClientLeft = 60
ClientTop = 450
ClientWidth = 7815
Icon = "Form8.frx":0000
LinkTopic = "Form8"
ScaleHeight = 5340
ScaleWidth = 7815
StartUpPosition = 1 '所有者中心
Begin FlexCell.Grid Grid1
Height = 4815
Left = 240
TabIndex = 0
Top = 240
Width = 7335
_ExtentX = 12938
_ExtentY = 8493
Appearance = 0
Cols = 5
Rows = 30
End
End
Attribute VB_Name = "Form8"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private mblnChanged As Boolean
Dim i, j As Integer
Private Sub Form_Load()
On Error GoTo finish
Grid1.SetRegisterInformation "CNwinndy", "W]vyY-nonvk-u\nty-Zbl_e-`hms^" '进行注册
Dim i As Long
Dim ac1, ac2, ac3, ac4, ac5 As Integer
Grid1.AutoRedraw = False
Grid1.CellBorderColorFixed = vbButtonShadow
Grid1.FixedRowColStyle = Flat
Grid1.Rows = 3
Grid1.Cols = 2
Grid1.RowHeight(1) = 30
For i = 1 To 1
Grid1.Column(i).Width = 70
Next
Set qy1 = cnn.Execute("select 课程名称 from 课程")
Do While Not qy1.EOF
Grid1.Cols = Grid1.Cols + 1
Grid1.Cell(2, Grid1.Cols - 1).Text = qy1.Fields(0)
qy1.MoveNext
Loop
'设置单元格文字
Grid1.Cell(1, 1).Text = tbbm1 '图表的表名称
Grid1.Cell(2, 1).Text = "姓 名"
tbsql1 = "select 名字 from 学生信息 where 班级='" & Class & "' order by 学号 asc"
Set qy1 = cnn.Execute(tbsql1)
Do While Not qy1.EOF
Grid1.Rows = Grid1.Rows + 1
Grid1.Cell(Grid1.Rows - 1, 1).Text = qy1.Fields(0)
qy1.MoveNext
Loop
For j = 2 To Grid1.Cols - 1
For i = 3 To Grid1.Rows - 1
tbsql1 = "SELECT 成绩 from 学生信息,学生与课程 where 名字='" & Grid1.Cell(i, 1).Text & "' and 班级='" & Class & "' and 课程名称='" & Grid1.Cell(2, j).Text & "' order by 学生信息.学号 asc"
Set qy1 = cnn.Execute(tbsql1)
Do While Not qy1.EOF
Grid1.Cell(i, j).Text = qy1.Fields(0)
qy1.MoveNext
Loop
Next
Next
For i = 1 To Grid1.Cols - 1
Grid1.Column(i).Width = 90
Next
'设置单元格格式
Grid1.Cell(1, 1).Font.SIZE = 12
Grid1.Range(1, 1, 1, Grid1.Cols - 1).Merge
Grid1.Range(1, 1, Grid1.Rows - 1, 1).Alignment = cellCenterCenter
Grid1.Range(2, 1, Grid1.Rows - 1, Grid1.Cols - 1).Alignment = cellCenterCenter
'Grid1.Range(3, 2, Grid1.Rows - 1, Grid1.Cols - 1).Alignment = cellRightCenter
Grid1.Range(2, 1, Grid1.Rows - 1, Grid1.Cols - 1).BackColor = RGB(90, 158, 214)
Grid1.Range(2, 1, Grid1.Rows - 1, 1).BackColor = vbYellow
With Grid1.Range(1, 1, Grid1.Rows - 1, Grid1.Cols - 1)
.Borders(cellEdgeLeft) = cellThin
.Borders(cellEdgeRight) = cellThin
.Borders(cellEdgeTop) = cellThin
.Borders(cellEdgeBottom) = cellThin
.Borders(cellInsideHorizontal) = cellThin
.Borders(cellInsideVertical) = cellThin
End With
Grid1.PageSetup.CenterHorizontally = True
'设置打印区域
Grid1.PageSetup.PrintRows = Grid1.Rows - 1
Grid1.PageSetup.PrintColumns = Grid1.Cols - 1
Grid1.AutoRedraw = True
Grid1.Refresh
Exit Sub
finish:
If qy1.EOF = True Then
MsgBox "无任何对应数据!"
Exit Sub
Else
MsgBox Err.Description
End If
End Sub
Private Sub Form_Resize()
If Me.WindowState <> 1 Then
Grid1.Left = 240
Grid1.Width = Me.Width - 480
Grid1.Top = 240
Grid1.Height = Me.Height - 960
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -