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

📄 frmdept1.frm

📁 朋友给的
💻 FRM
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form frmDept1 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "员工照片"
   ClientHeight    =   6510
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   8625
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   6510
   ScaleWidth      =   8625
   ShowInTaskbar   =   0   'False
   Begin VB.Frame Frame4 
      Appearance      =   0  'Flat
      ForeColor       =   &H80000008&
      Height          =   5475
      Left            =   2445
      TabIndex        =   2
      Top             =   0
      Width           =   6135
      Begin VB.TextBox Text13 
         Enabled         =   0   'False
         Height          =   330
         Left            =   1290
         TabIndex        =   7
         Top             =   270
         Width           =   1695
      End
      Begin VB.TextBox Text14 
         Enabled         =   0   'False
         Height          =   330
         Left            =   4140
         TabIndex        =   6
         Top             =   270
         Width           =   1695
      End
      Begin VB.Frame Frame7 
         Height          =   150
         Left            =   120
         TabIndex        =   5
         Top             =   660
         Width           =   5865
      End
      Begin VB.Frame Frame8 
         Height          =   3480
         Left            =   1605
         TabIndex        =   3
         Top             =   1080
         Width           =   3195
         Begin VB.Image Image1 
            Height          =   3270
            Left            =   60
            Stretch         =   -1  'True
            Top             =   150
            Width           =   3075
         End
         Begin VB.Label Label1 
            Alignment       =   2  'Center
            BackStyle       =   0  'Transparent
            Caption         =   "无照片"
            BeginProperty Font 
               Name            =   "隶书"
               Size            =   42
               Charset         =   134
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H000000FF&
            Height          =   2745
            Left            =   915
            TabIndex        =   4
            Top             =   375
            Width           =   1290
         End
      End
      Begin MSComDlg.CommonDialog CommonDialog1 
         Left            =   5085
         Top             =   1725
         _ExtentX        =   847
         _ExtentY        =   847
         _Version        =   393216
      End
      Begin VB.Label Label21 
         Caption         =   "工    号:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   300
         Left            =   240
         TabIndex        =   10
         Top             =   330
         Width           =   1185
      End
      Begin VB.Label Label37 
         Caption         =   "姓    名:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   300
         Left            =   3165
         TabIndex        =   9
         Top             =   330
         Width           =   1185
      End
      Begin VB.Label Label20 
         Alignment       =   2  'Center
         Caption         =   "照片"
         BeginProperty Font 
            Name            =   "华文彩云"
            Size            =   18
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   390
         Left            =   2340
         TabIndex        =   8
         Top             =   4740
         Width           =   1680
      End
   End
   Begin VB.Frame Frame6 
      Appearance      =   0  'Flat
      ForeColor       =   &H80000008&
      Height          =   6465
      Left            =   45
      TabIndex        =   0
      Top             =   0
      Width           =   2370
      Begin MSFlexGridLib.MSFlexGrid MSFlexGrid2 
         Height          =   6225
         Left            =   75
         TabIndex        =   1
         Top             =   165
         Width           =   2205
         _ExtentX        =   3889
         _ExtentY        =   10980
         _Version        =   393216
         FixedCols       =   0
         Appearance      =   0
      End
   End
   Begin VB.Frame Frame5 
      Appearance      =   0  'Flat
      ForeColor       =   &H80000008&
      Height          =   1050
      Left            =   2445
      TabIndex        =   11
      Top             =   5415
      Width           =   6135
      Begin VB.CommandButton Command5 
         Caption         =   "保存照片(&S)"
         Height          =   510
         Left            =   1530
         TabIndex        =   15
         Top             =   315
         Width           =   1275
      End
      Begin VB.CommandButton Command6 
         Caption         =   "删除照片(&D)"
         Height          =   510
         Left            =   2910
         TabIndex        =   14
         Top             =   315
         Width           =   1275
      End
      Begin VB.CommandButton Command7 
         Caption         =   "退 出(&E)"
         Height          =   510
         Left            =   4290
         TabIndex        =   13
         Top             =   315
         Width           =   1275
      End
      Begin VB.CommandButton Command8 
         Caption         =   "选 择(&F)"
         Height          =   510
         Left            =   150
         TabIndex        =   12
         Top             =   315
         Width           =   1275
      End
   End
End
Attribute VB_Name = "frmDept1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim strHead As String
Dim strWid  As String
Dim pic() As Byte
Dim Filename As String

Private Sub Command5_Click()
    Dim rs As New ADODB.Recordset
    Dim strYYY As String
    strYYY = "select * from T_员工表"
    rs.Open strYYY, gCnn, adOpenDynamic, adLockOptimistic
    rs.Filter = "工号='" & Trim(Text13.Text) & "'"
    If rs.RecordCount > 0 Then
    
        If Filename = "" Then
    '        rsdept.Fields("PHOTO") = Null
        Else
            rs.Fields("照片") = pic
        End If
    rs.Update
    End If
    pic = ""
    Filename = ""
    MsgBox "保存成功!", vbInformation, "系统提示"
    Call Form_Load
End Sub

Private Sub Command6_Click()
    Dim rs As New ADODB.Recordset
    Dim strYYY As String
    
    If MsgBox("你确定要删除此员工的照片么?", vbYesNo, "系统提示") = vbNo Then: Exit Sub
    
    gCnn.Execute "update T_员工表 set 照片=null where 工号='" & Trim(Text13.Text) & "'"
    MsgBox "删除成功!", vbInformation, "系统提示"
    Call Form_Load
    
End Sub

Private Sub Command7_Click()
    Unload Me
End Sub

Private Sub Command8_Click()
   On Error GoTo ExitNow
   Dim filedir As String
'   Dim Filename As String
   Dim fso As New FileSystemObject
   Dim DestPFld As Scripting.Folder, DestFld As Scripting.Folder
   
   CommonDialog1.Filter = "BitMaps|*.bmp|JPEG|*.jpg|GIF|*.gif"
   CommonDialog1.FilterIndex = 2
   CommonDialog1.DialogTitle = "选择源文件!"
   CommonDialog1.CancelError = True
   CommonDialog1.ShowOpen
   Filename = CommonDialog1.Filename
   
   
   Image1.Picture = LoadPicture(Filename)
  
  '========保存图片===========

   Open Filename For Binary As #1
     
   If FileLen(Filename) = 0 Then
     MsgBox "空图片!", vbInformation, "系统提示"
   Else
     ReDim pic(FileLen(Filename))
     Label1.Visible = False
     Get #1, , pic
   End If
   
   Close #1
  
  '========保存图片===========
ExitNow:
End Sub

Private Sub Form_Load()

'ID,工号,姓名,性别,出生年月,身份证号,电话,手机,电子邮箱,住址,学历,民族,毕业院校,所学专业,上班日期,职务,职称,部门,员工状态,奖惩记录,培训记录,照片  T_员工表
    Dim rs As New ADODB.Recordset
    If Me.WindowState = 0 Then Me.Move 0, 0

    Call ShowHead1
    If rs.State = 1 Then rs.Close
    MSFlexGrid2.Rows = 1
    
    gSQL = "select 工号,姓名,身份证号,性别,出生年月,电话,手机,电子邮箱,住址,民族,毕业院校,所学专业,上班日期,学历,职务,职称,部门,员工状态 from T_员工表 "
    rs.Open gSQL, gCnn, adOpenStatic, adLockReadOnly
    If rs.RecordCount >= 1 Then
        rs.MoveFirst
        
        Do While Not rs.EOF

            MSFlexGrid2.Rows = MSFlexGrid2.Rows + 1
            MSFlexGrid2.Row = MSFlexGrid2.Rows - 1
            MSFlexGrid2.TextMatrix(MSFlexGrid2.Row, 0) = rs.Fields(0).Value
            MSFlexGrid2.TextMatrix(MSFlexGrid2.Row, 1) = rs.Fields(1).Value
            rs.MoveNext
        Loop
        
    End If
    
    gtxtclear

End Sub

Private Sub ShowHead1()
    'MSFlexGrid1设置
    strHead = "工号,姓名"
    strWid = "800,1200"
    FillGridHead MSFlexGrid2, strHead, strWid
    
End Sub

Public Sub gtxtclear()

        Text13 = ""
        Text14 = ""

        Image1.Picture = LoadPicture("")
        Label1.Visible = True

End Sub

Private Sub MSFlexGrid2_Click()
    Dim rsTemp As New ADODB.Recordset
    If MSFlexGrid2.Rows = 1 Then Exit Sub
    If MSFlexGrid2.TextMatrix(MSFlexGrid2.Row, 1) = "" Then Exit Sub
    Text13.Text = MSFlexGrid2.TextMatrix(MSFlexGrid2.Row, 0)
    Text14.Text = MSFlexGrid2.TextMatrix(MSFlexGrid2.Row, 1)
    
    
    '=========显示图片=========
    If rsTemp.State = 1 Then rsTemp.Close
    rsTemp.Open "select 照片 from T_员工表 where 工号='" & Text13.Text & "'", gCnn, adOpenStatic, adLockReadOnly
    
    If IsNull(rsTemp.Fields("照片").Value) = True Then
        Image1.Picture = LoadPicture("")
        Label1.Visible = True
        pic = ""
        Filename = ""
    Else
        pic = rsTemp.Fields("照片").Value
         If Dir("temp.jpg") <> "" Then
           Kill ("temp.jpg")
         End If
         Open "temp.jpg" For Binary As #1
         Put #1, , pic
         Close #1
         Image1.Picture = LoadPicture("temp.jpg")
         If Dir("temp.jpg") <> "" Then
           Kill ("temp.jpg")
         End If
         Label1.Visible = False
    End If
    '=========显示图片=========
    Set rsTemp = Nothing
    
End Sub

⌨️ 快捷键说明

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