📄 mainform.frm
字号:
Width = 1215
End
Begin VB.TextBox Text1
DataField = "姓名"
DataSource = "Data"
Height = 270
Index = 0
Left = 1560
MousePointer = 1 'Arrow
TabIndex = 5
Top = 360
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "新增"
Height = 375
Left = 1200
TabIndex = 4
Top = 4320
Width = 1095
End
Begin VB.Label Label13
AutoSize = -1 'True
Caption = "手 机:"
Height = 180
Left = 2760
TabIndex = 29
Top = 3900
Width = 900
End
Begin VB.Label Label12
AutoSize = -1 'True
Caption = "BP 机:"
Height = 180
Left = 240
TabIndex = 27
Top = 3900
Width = 900
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "单位电话:"
Height = 180
Left = 2760
TabIndex = 25
Top = 3540
Width = 900
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "住宅电话:"
Height = 180
Left = 240
TabIndex = 23
Top = 3540
Width = 900
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "小燕子专用版"
BeginProperty Font
Name = "宋体"
Size = 36
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000001&
Height = 720
Left = 360
TabIndex = 21
Top = 1800
Width = 4320
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "工作单位:"
Height = 180
Left = 240
TabIndex = 20
Top = 3060
Width = 900
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "家庭地址:"
Height = 180
Left = 240
TabIndex = 18
Top = 2700
Width = 900
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "Email:"
Height = 180
Left = 240
TabIndex = 16
Top = 1500
Width = 630
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "QQ号:"
Height = 180
Left = 3120
TabIndex = 14
Top = 420
Width = 540
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "生日:"
Height = 180
Left = 240
TabIndex = 11
Top = 1140
Width = 540
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "昵称:"
Height = 180
Left = 3120
TabIndex = 10
Top = 780
Width = 540
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "性别:"
Height = 180
Left = 960
TabIndex = 8
Top = 780
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "姓名:"
Height = 180
Left = 960
TabIndex = 6
Top = 420
Width = 540
End
End
End
Attribute VB_Name = "MainForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Max_Show, Show_Length, String_Length As Integer
Dim Left2Right As Boolean
Private Sub Command1_Click()
ADD_NEW = True
Edit.Show
End Sub
Private Sub Command2_Click()
If InStr(TreeView.SelectedItem.FullPath, "★") <> 0 Then
ADD_NEW = False
Edit.Show
Else
MsgBox "选择要修改的项!"
End If
End Sub
Private Sub Command3_Click()
If InStr(TreeView.SelectedItem.FullPath, "★") <> 0 Then
TreeView.Nodes.Remove (TreeView.SelectedItem.Index)
Data.Recordset.Delete
Else
MsgBox "选择要删除的项!"
End If
End Sub
Private Sub Command4_Click()
If InStr(Text1(4).Text, "@") <> 0 Then
ShellExecute hwnd, "open", "mailto:" & Text1(4).Text, vbNullString, vbNullString, SW_SHOW
End If
End Sub
Private Sub Form_Load()
Max_Show = Fix((StatusBar.Width - 183) / StatusBar.Font.Size / 10)
If Len(StatusBar.SimpleText) <= Max_Show Then Timer1.Enabled = True
Left2Right = True
String_Length = Len(StatusBar.SimpleText)
Data.DatabaseName = App.Path & "\Data\person.mdb"
For i = 1 To 84
HeadPicture.Picture = LoadPicture()
HeadPicture.Picture = LoadPicture(App.Path & "\newface\" & Right("000" & i, 3) & ".bmp")
ImageList.ListImages.Add i, , HeadPicture.Picture
Next i
For i = Asc("A") To Asc("Z")
TreeView.Nodes.Add , , , Chr(i)
Next i
Me.Hide
Welcome.Show
End Sub
Public Function LoadData()
On Error Resume Next
Dim Person As Node
Dim PersonName As String
Dim xindex As Long
Dim TotalNum
Data.Recordset.MoveLast
TotalNum = Data.Recordset.RecordCount
Data.Recordset.MoveFirst
For i = 1 To TotalNum
PersonName = Text1(0).Text
xindex = Asc(UCase(Left(GetChineseSpell(PersonName), 1))) - 64
Set Person = TreeView.Nodes.Add(xindex, tvwChild, , PersonName, Val(Text1(11).Text))
If i = TotalNum Then
Data.Recordset.MoveFirst
HeadPicture.Picture = ImageList.ListImages(Val(Text1(11).Text)).Picture
Exit For
End If
Data.Recordset.MoveNext
Next i
For i = 0 To 11
Text1(i).Locked = True
Next i
DTPicker.Enabled = False
Err.Clear
End Function
Private Sub List1_Click()
MsgBox Asc(List1.List(List1.ListIndex))
End Sub
Private Sub Text1_GotFocus(Index As Integer)
Command1.SetFocus
End Sub
Private Sub Timer1_Timer()
Show_Length = Len(StatusBar.SimpleText)
If Left2Right Then
StatusBar.SimpleText = " " & StatusBar.SimpleText
If Show_Length = Max_Show - 1 Then Left2Right = False
Else
StatusBar.SimpleText = Right(StatusBar.SimpleText, Show_Length - 1)
If Show_Length = String_Length + 1 Then Left2Right = True
End If
End Sub
Private Sub TreeView_NodeClick(ByVal Node As MSComctlLib.Node)
If InStr(Node.FullPath, "★") <> 0 Then
Data.RecordSource = "SELECT * FROM Person where 姓名 = """ & Node.Text & """"
Data.Refresh
HeadPicture.Picture = LoadPicture()
HeadPicture.Picture = ImageList.ListImages(Val(Text1(11).Text)).Picture
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -