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

📄 frmuser.frm

📁 用VB写的和数据库联合编程的电子图档管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{00028C01-0000-0000-0000-000000000046}#1.0#0"; "DBGRID32.OCX"
Begin VB.Form FrmUser 
   BackColor       =   &H00FFC0FF&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "用户设置"
   ClientHeight    =   3420
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4785
   Icon            =   "FrmUser.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3420
   ScaleWidth      =   4785
   StartUpPosition =   1  '所有者中心
   Begin VB.ComboBox PurType 
      BackColor       =   &H00C0FFFF&
      ForeColor       =   &H00FF0000&
      Height          =   300
      ItemData        =   "FrmUser.frx":08CA
      Left            =   3120
      List            =   "FrmUser.frx":08DD
      Style           =   2  'Dropdown List
      TabIndex        =   2
      Top             =   840
      Visible         =   0   'False
      Width           =   1275
   End
   Begin VB.Data Data1 
      Caption         =   "Data2"
      Connect         =   ";pwd=prowind"
      DatabaseName    =   ""
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   345
      Left            =   3600
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   3000
      Visible         =   0   'False
      Width           =   1140
   End
   Begin MSDBGrid.DBGrid DBGrid2 
      Bindings        =   "FrmUser.frx":0903
      Height          =   2865
      Left            =   120
      OleObjectBlob   =   "FrmUser.frx":0917
      TabIndex        =   0
      Top             =   120
      Width           =   4545
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFC0FF&
      Caption         =   "选中项后,按Delete键即可删除该项,双击更改权限"
      Height          =   255
      Left            =   120
      TabIndex        =   1
      Top             =   3120
      Width           =   4455
   End
End
Attribute VB_Name = "FrmUser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False


Private Sub DBGrid2_DblClick()
   '如果不是第三个数据字段则退出
   If DBGrid2.Col <> 2 Or DBGrid2.Columns(0).Value = "" Then Exit Sub
   '重置组合框的位置
   PurType.left = DBGrid2.left + DBGrid2.Columns(2).left
   PurType.Top = DBGrid2.Top + DBGrid2.RowHeight * (DBGrid2.Row + 2) - 50
   
   If DBGrid2.Columns(2).Value <> "" Then
      PurType.text = DBGrid2.Columns(2).Value
   Else
      PurType.text = "只读"
   End If
   '显示组合框,并使其获取焦点
   PurType.Visible = True
   PurType.SetFocus
   
End Sub

Private Sub DBGrid2_GotFocus()
   '主框架获取焦点,组合框失去焦点,更新数据
   If PurType.text <> "" Then
      DBGrid2.Columns(2).Value = PurType.text
      PurType.Visible = False
   End If
   
End Sub

Private Sub Form_Load()
    '初始化数据源
    Data1.DatabaseName = App.Path + "\data.mdb"
    Data1.RecordSource = "user"
    
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    '是否拥有一个以上的管理员权限的用户,没有则不能关闭窗口
    Data1.Recordset.FindFirst "权限='管理员'"

    If Data1.Recordset.NoMatch Then
        MsgBox "您至少要设置一个拥有管理员权限的用户!"
        Cancel = True
    End If
    
End Sub

Private Sub PurType_Click()
   '组合框选中新数据,更新数据库数据,隐藏组合框,并失去焦点
   DBGrid2.Columns(2).Value = PurType.text
   PurType.Visible = False
   
End Sub

⌨️ 快捷键说明

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