VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
Begin VB.Form frmClass1 
   Caption         =   "Class"
   ClientHeight    =   2715
   ClientLeft      =   1110
   ClientTop       =   345
   ClientWidth     =   4110
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   ScaleHeight     =   2715
   ScaleWidth      =   4110
   Begin VB.CommandButton cmdClose 
      Cancel          =   -1  'True
      Caption         =   "关闭(&C)"
      Height          =   300
      Left            =   3000
      TabIndex        =   0
      Top             =   2400
      Width           =   1080
   End
   Begin MSAdodcLib.Adodc datPrimaryRS 
      Align           =   2  'Align Bottom
      Height          =   330
      Left            =   0
      Top             =   2385
      Width           =   4110
      _ExtentX        =   7250
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "PROVIDER=Microsoft.Jet.OLEDB.3.51;Data Source=Mydb.mdb;"
      OLEDBString     =   "PROVIDER=Microsoft.Jet.OLEDB.3.51;Data Source=Mydb.mdb;"
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "select 课程名,学号,成绩,学期 from Class"
      Caption         =   " "
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin MSHierarchicalFlexGridLib.MSHFlexGrid MSHFlexGrid1 
      Bindings        =   "sy11-18.frx":0000
      Height          =   2340
      Left            =   60
      TabIndex        =   1
      Top             =   60
      Width           =   3720
      _ExtentX        =   6562
      _ExtentY        =   4128
      _Version        =   393216
      BackColor       =   16777215
      ForeColor       =   0
      Rows            =   9
      Cols            =   4
      FixedCols       =   0
      BackColorFixed  =   0
      ForeColorFixed  =   16777215
      GridColor       =   12632256
      GridColorFixed  =   0
      WordWrap        =   -1  'True
      AllowBigSelection=   0   'False
      FocusRect       =   0
      HighLight       =   0
      MergeCells      =   4
      AllowUserResizing=   1
      FormatString    =   "课程名|学号|成绩|学期"
      _NumberOfBands  =   1
      _Band(0).Cols   =   4
      _Band(0).GridLineWidthBand=   1
      _Band(0).TextStyleBand=   0
   End
End
Attribute VB_Name = "frmClass1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Const MARGIN_SIZE = 60      ' 单位为缇
Private Sub Form_Load()
    Dim i As Integer
    '使ADO控件datPrimaryRS不可见
    datPrimaryRS.Visible = False

    With MSHFlexGrid1
        .Redraw = False
        ' 设置网格列宽度
        .ColWidth(0) = -1
        .ColWidth(1) = -1
        .ColWidth(2) = -1
        .ColWidth(3) = -1
        ' 设置网格列合并和排序
        For i = 0 To .Cols - 1
            .MergeCol(i) = True
        Next i
        .Sort = flexSortGenericAscending
        ' 设置网格样式
        .AllowBigSelection = True
        .FillStyle = flexFillRepeat
        ' 将标头作成粗体
        .Row = 0
        .Col = 0
        .RowSel = .FixedRows - 1
        .ColSel = .Cols - 1
        .CellFontBold = True
        .AllowBigSelection = False
        .FillStyle = flexFillSingle
        .Redraw = True
    End With

End Sub

Private Sub Form_Resize()
    '当窗体改变大小时移动“关闭”按钮到右下角
    Dim sngButtonTop As Single
    Dim sngScaleWidth As Single
    Dim sngScaleHeight As Single
    On Error GoTo Form_Resize_Error

    With Me
        sngScaleWidth = .ScaleWidth
        sngScaleHeight = .ScaleHeight

        ' 移动“关闭”按钮到右下角
        With .cmdClose
                sngButtonTop = sngScaleHeight - (.Height + MARGIN_SIZE)
                .Move sngScaleWidth - (.Width + MARGIN_SIZE), sngButtonTop
        End With

        .MSHFlexGrid1.Move MARGIN_SIZE, _
            MARGIN_SIZE, _
            sngScaleWidth - (2 * MARGIN_SIZE), _
            sngButtonTop - (2 * MARGIN_SIZE)

    End With
    Exit Sub
Form_Resize_Error:
    ' 避免负值错误
    Resume Next
End Sub
Private Sub cmdClose_Click()
    Unload Me
End Sub


