⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 formshow.frm

📁 期末考试日程安排系统(VB+ACCESS) 系统解图也在压缩包里面了。挺漂亮的
💻 FRM
字号:
VERSION 5.00
Object = "{CFA7AFF4-3242-4269-9172-7389D695AE01}#1.0#0"; "StoneXP.ocx"
Object = "{DAAC6951-59A4-4C08-9D6E-FE3919B64861}#1.0#0"; "FlexCell.ocx"
Begin VB.Form formshow 
   Caption         =   "查看"
   ClientHeight    =   6660
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   9255
   Icon            =   "formshow.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   6660
   ScaleWidth      =   9255
   StartUpPosition =   3  '窗口缺省
   WindowState     =   2  'Maximized
   Begin StoneXP.XPButton XPButton1 
      Height          =   375
      Left            =   2640
      TabIndex        =   1
      Top             =   120
      Width           =   1095
      _ExtentX        =   1931
      _ExtentY        =   661
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Caption         =   "打印"
      MouseIcon       =   "formshow.frx":F84A
      MousePointer    =   99
   End
   Begin FlexCell.Grid Grid1 
      Height          =   6375
      Left            =   0
      TabIndex        =   0
      Top             =   360
      Width           =   9015
      _ExtentX        =   15901
      _ExtentY        =   11245
      Appearance      =   0
      Cols            =   5
      Rows            =   1
   End
   Begin VB.Menu prints 
      Caption         =   "打印"
      Visible         =   0   'False
      Begin VB.Menu print 
         Caption         =   "打印内容"
      End
   End
End
Attribute VB_Name = "formshow"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim m, n, X, Y, len1 As Integer
Dim str1, sstr1 As String
Private Sub Form_Load()
Grid1.SetRegisterInformation "CNwinndy", "W]vyY-nonvk-u\nty-Zbl_e-`hms^" '进行注册
With Grid1  '以下是对表格控件进行一些颜色和字体等设置
    .AllowUserResizing = True
    .DisplayFocusRect = False
    .ExtendLastCol = True
    .Appearance = Flat
    .FixedRowColStyle = Flat
    .ScrollBarStyle = Flat
    
    .DefaultFont.Name = "Tahoma"
    .DefaultFont.SIZE = 10
    .BackColorFixed = RGB(84, 201, 134) 'RGB(90, 158, 214)
    .BackColorFixedSel = RGB(84, 201, 134) 'RGB(110, 180, 230)
    .BackColorBkg = RGB(84, 201, 134) 'RGB(90, 158, 214)
    .BackColorScrollBar = RGB(231, 235, 247)
    .BackColor1 = RGB(231, 235, 247)
    .BackColor2 = RGB(239, 243, 255)
    .GridColor = RGB(148, 190, 231)
    .Column(0).Width = 120
    '.RowHeight(0) = 0
    .ReadOnly = True
End With
Me.BackColor = RGB(84, 201, 134)
Generalview '在窗体启动时自动调用过程
End Sub

Private Sub Generalview()
On Error GoTo finish
 Set ks1 = cnn.Execute("select count(*) from 日程设定")
 Grid1.Cols = ks1.Fields(0) + 1 '通过记录数来设置列数
 Grid1.Rows = 1
 Grid1.RowHeight(0) = 50 '设置行高
 Set ks1 = cnn.Execute("select * from 日程设定 order by  序号 asc")
'通过SQL的查询语句将日程设定的日期和时间写入表格
 For i = 1 To Grid1.Cols - 1
 Grid1.Column(i).Width = 120
 Grid1.Cell(0, i).Text = ks1.Fields(0) & vbCrLf & ks1.Fields(1)
 ks1.MoveNext
 Next
 m = 1 '变量初始化
 n = 0
 X = 1
 Set ks2 = cnn.Execute("SELECT DISTINCT 系名 from 课程")
 Do While Not ks2.EOF
For i = 1 To 4 '通过固定的1-4年级和系名来确定可以存在的年级
 Set ks3 = cnn.Execute("select count(*) from 课程 where 系名='" & ks2.Fields(0) & "' and 年级='" & i & "'")
 If ks3.Fields(0) > 0 Then
 Grid1.Rows = Grid1.Rows + 1
 Grid1.RowHeight(Grid1.Rows - 1) = 120
 Grid1.Cell(Grid1.Rows - 1, 0).Text = ks2.Fields(0) & vbCrLf & i & "年级"
 Set ks3 = cnn.Execute("select * from 生成 where 系名='" & ks2.Fields(0) & "' and 年级='" & i & "' order by  序号 asc")
 '这里开始查询对应班级的考试安排情况
 j = 0
 Do While Not ks3.EOF
  j = j + 1
  len1 = Len(ks3.Fields(3))
  m = 1
  Y = 1
  For n = 1 To len1 '由于每个系并不一定就是一个考场教室,所以在用逗号分开的各教室号在次区别开来
   If Mid(ks3.Fields(3), n, 1) = "," Then
    str1 = Mid(ks3.Fields(3), m, Y - 1)
    m = n + 1
    Y = 0
    '查找并合并对应的监考教师并写入表格
    Set ks4 = cnn.Execute("select * from 监考教师 where 日期='" & ks3.Fields(0) & "' and 时间='" & ks3.Fields(1) & "' and 教室号='" & str1 & "'")
    sstr1 = sstr1 & str1 & "(" & ks4.Fields(1) & "),"
   End If
   Y = Y + 1
  Next
    str1 = Mid(ks3.Fields(3), m, Y - 1)
    m = n + 1
    Y = 0
    Set ks4 = cnn.Execute("select * from 监考教师 where 日期='" & ks3.Fields(0) & "' and 时间='" & ks3.Fields(1) & "' and 教室号='" & str1 & "'")
    sstr1 = sstr1 & str1 & "(" & ks4.Fields(1) & ")"
  Grid1.Cell(Grid1.Rows - 1, j).Text = ks3.Fields(2) & vbCrLf & "教室:" & ks3.Fields(3) & vbCrLf & "监考:" & sstr1
  sstr1 = ""
  ks3.MoveNext
 Loop
 End If
Next
ks2.MoveNext
Loop
 Grid1.Range(0, 0, Grid1.Rows - 1, Grid1.Cols - 1).WrapText = True
 '这句的意义是从某行某列开始到某行某列结束,这之间
 '  的单元格文字如果超过了单元格规定范围,就允许自动换行
 Grid1.Range(0, 0, Grid1.Rows - 1, Grid1.Cols - 1).Alignment = cellCenterCenter
 '同上注释,主要是设置单元格中的内容居中
 Exit Sub
finish:
MsgBox Err.Description
End Sub

Private Sub Form_Resize()
If Me.WindowState <> 1 Then
    Grid1.Left = (Me.Width - Grid1.Width) / 2
    Grid1.Width = (Me.Width / 2) + Grid1.Left
    Grid1.Left = (Me.Width - Grid1.Width) / 2
    Grid1.Top = 600
    Grid1.Height = Me.Height - Grid1.Top - 600
    XPButton1.Left = (Me.Width - XPButton1.Width) / 2
End If
End Sub

Private Sub print_Click()
On Error GoTo finish
    '设置打印区域
    Grid1.PageSetup.PrintFixedRow = True '设定是否允许打印第0行
    Grid1.PageSetup.PrintFixedColumn = True '是否打印第0列
    Grid1.PageSetup.PrintRows = Grid1.Rows - 1 '需要打印的总行数
    Grid1.PageSetup.PrintColumns = Grid1.Cols - 1 '需要打印的总列数
    Grid1.PageSetup.PrintGridlines = True '是否显示中间的分隔线,即表格线
    'Grid1.AutoRedraw = True
    Grid1.PageSetup.Orientation = cellLandscape '采用横幅打印还是竖行打印
    'Grid1.PrintDialog
    Grid1.PrintPreview '打印预览
    Grid1.Refresh
    Exit Sub
finish:
    MsgBox Err.Description
End Sub

Private Sub XPButton1_Click()
Call print_Click
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -