📄 frm_xscx.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form Frm_xscx
Caption = "Form2"
ClientHeight = 6270
ClientLeft = 60
ClientTop = 435
ClientWidth = 8805
FillColor = &H00FF0000&
LinkTopic = "Form2"
ScaleHeight = 6270
ScaleWidth = 8805
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
BackColor = &H00FFC0C0&
Caption = "Command1"
Height = 495
Left = 7200
MaskColor = &H00008080&
Style = 1 'Graphical
TabIndex = 3
Top = 3840
Width = 1215
End
Begin MSComctlLib.ImageList ImageList1
Left = 7320
Top = 1680
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 48
ImageHeight = 48
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 9
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_xscx.frx":0000
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_xscx.frx":0A46
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_xscx.frx":14D8
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_xscx.frx":2001
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_xscx.frx":2B7B
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_xscx.frx":31BF
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_xscx.frx":5640
Key = ""
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_xscx.frx":5C6B
Key = ""
EndProperty
BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_xscx.frx":6291
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 1050
Left = 0
TabIndex = 0
Top = 0
Width = 8805
_ExtentX = 15531
_ExtentY = 1852
ButtonWidth = 1561
ButtonHeight = 1799
Appearance = 1
Style = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 12
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "新建"
ImageIndex = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "修改"
ImageIndex = 2
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "删除"
ImageIndex = 3
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "查询"
ImageIndex = 4
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "首记录"
ImageIndex = 5
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "末记录"
ImageIndex = 6
EndProperty
BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "上一条"
ImageIndex = 7
EndProperty
BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "下一条"
ImageIndex = 8
EndProperty
BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "取消/退出"
ImageIndex = 9
EndProperty
EndProperty
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 4455
Left = 0
TabIndex = 1
Top = 1080
Width = 6975
_ExtentX = 12303
_ExtentY = 7858
_Version = 393216
BackColor = 16761024
ForeColor = 16761087
BackColorFixed = 16744576
ForeColorFixed = -2147483636
BackColorSel = -2147483634
BackColorBkg = -2147483633
AllowUserResizing= 3
End
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 375
Left = 0
TabIndex = 2
Top = 5895
Width = 8805
_ExtentX = 15531
_ExtentY = 661
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 1
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
AutoSize = 1
Object.Width = 15055
EndProperty
EndProperty
End
End
Attribute VB_Name = "Frm_xscx"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Me.BackColor = RGB(175, 238, 227)
Dim sql As String
sql = "select * from 宿舍" '改变数据来源
ShowData sql, Me.MSFlexGrid1
Me.MSFlexGrid1.ColAlignment(0) = flexAlignCenterright
Me.MSFlexGrid1.ColAlignment(1) = flexAlignCenterright
Me.MSFlexGrid1.ColAlignment(2) = flexAlignCenterright
Me.MSFlexGrid1.ColAlignment(3) = flexAlignCenterright
Me.MSFlexGrid1.ColWidth(0) = 1000
Me.MSFlexGrid1.ColWidth(1) = 1500
Me.MSFlexGrid1.ColWidth(2) = 1500
''Me.MSFlexGrid1.ColWidth(3) = 3200
Me.StatusBar1.Panels(1).Text = "总行数为:" & Me.MSFlexGrid1.Rows - 1 '不能用加号,因为加号连接的两边必须全为字符串
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Index
Case 1
Frm_xsgx.Caption = "添加记录"
Frm_xsgx.Show 1
Me.StatusBar1.Panels(1).Text = "总行数为:" & Me.MSFlexGrid1.Rows - 1 '不能用加号,因为加号连接的两边必须全为字符串
Case 2
With Frm_xsgx
.Caption = "修改记录"
.Txt_zydm.Text = Me.MSFlexGrid1.TextMatrix(Me.MSFlexGrid1.Row, 0)
.Txt_zymc.Text = Me.MSFlexGrid1.TextMatrix(Me.MSFlexGrid1.Row, 1)
.Txt_xbdm.Text = Me.MSFlexGrid1.TextMatrix(Me.MSFlexGrid1.Row, 2)
ShowImage
.Show 1
End With
Case 3 '改变2
If MsgBox("你确定要删除记录吗?", vbYesNo + vbQuestion, "询问") = vbYes Then
Dim sql As String, rtn As Long
sql = "delete 宿舍 where 姓名='" + Me.MSFlexGrid1.TextMatrix(Me.MSFlexGrid1.Row, 0) + "'" '动静分离(2)改变删除操作
rtn = Update(sql)
If rtn = 0 Then
MsgBox "删除成功!"
sql = "select * from 宿舍"
ShowData sql, Me.MSFlexGrid1
Else
MsgBox "出现系统错误! 请重启本系统!"
End If
End If
Me.StatusBar1.Panels(1).Text = "总行数为:" & Me.MSFlexGrid1.Rows - 1 '不能用加号,因为加号连接的两边必须全为字符串
Case 5
Unload Me
Frm_xscz.Show 1
Case 7
MoveFirst Me.MSFlexGrid1
Case 8
MoveLast Me.MSFlexGrid1
Case 9
MovePre Me.MSFlexGrid1
Case 10
MoveNext Me.MSFlexGrid1
Case 12
Unload Me
End Select
End Sub
Private Sub ShowImage()
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim stm As New ADODB.Stream
Dim sql As String
sql = "select 相片 from 宿舍 where 学号='" + Me.MSFlexGrid1.TextMatrix(Me.MSFlexGrid1.Row, 0) + "'" '动静分离
picfile = "C:\pic.bmp"
cnn.Open strcnn
rst.Open sql, cnn, 3, 1
If rst.RecordCount > 0 Then
If rst.Fields("相片").ActualSize <= 0 Then
Frm_xsgx.Image1.Picture = LoadPicture("")
'' Img_xp.Picture = LoadPicture(Me.CommonDialog1.FileName)
Else
stm.Type = adTypeBinary
stm.Open
stm.Write rst!相片
stm.SaveToFile picfile, adSaveCreateOverWrite
stm.Close
rst.Close
cnn.Close
Frm_xsgx.Image.Picture = LoadPicture(picfile)
Frm_xsgx.CommonDialog1.FileName = picfile
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -