📄 系统_主操作桌面.frm
字号:
If Xtgnbrec.Fields("mjbz") = True Then
gnsyte = Trim(Xtgnbrec.Fields("gnsy"))
Call Zxxymk(gnsyte)
Else
'---------------
Dim SSql As String
sjgnbmStr = ""
lvListView.ColumnHeaders.Clear
lvListView.ListItems.Clear
SSql = "SELECT * FROM xt_xtgnb where sjgnbm='" + Xtgnbrec.Fields("gnbm") + "' and MenuList=1 order by gnbm"
Set Xtgnbrec = Cw_DataEnvi.DataConnect.Execute(SSql)
lvListView.ColumnHeaders.Add 1, "rcsw", tvTreeView.SelectedItem.Text, 3000, , "stb"
Do While Not Xtgnbrec.EOF
Set mitem = lvListView.ListItems.Add()
mitem.Text = Trim(Xtgnbrec!gnmc)
If Xtgnbrec.Fields("mjbz") Then
mitem.SmallIcon = "gnqx"
mitem.Icon = "y"
Else
mitem.Icon = "i"
mitem.SmallIcon = "stb"
End If
mitem.Key = "T" & Trim(Xtgnbrec!gnbm)
Xtgnbrec.MoveNext
Loop
'---------------
End If
End If
End If
End Sub
Private Sub lvListView_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
'5.04增加-------------
isLeftButton = True
lvListViewDblclickOk = True
'--------------------------
Call lvListView_DblClick
End If
End Sub
'5.04增加
Private Sub lvListView_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then
isLeftButton = True
Else
isLeftButton = False
End If
If lvListView.HitTest(x, y) Is Nothing Then
lvListViewDblclickOk = False
Else
lvListViewDblclickOk = True
End If
End Sub
Private Sub Timer1_Timer()
Dim login_mode As String '注册模式
login_mode = GetSetting(Ebo_gsProductName, Ebo_gsPrjName, "login_mode", login_mode)
Select Case Trim(login_mode)
Case "10" '重新注册确定
Timer1.Enabled = False
Call Xtcsh
tvTreeView.Nodes.Clear
Me.Cshgns
Case "30" '重新注册,没有按下确定或取消按钮
Exit Sub
Case Else
Timer1.Enabled = False
End Select
End Sub
'5.04
Private Sub tvTreeView_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then
isLeftButton = True
Else
isLeftButton = False
End If
If tvTreeView.HitTest(x, y) Is Nothing Then
tvTreeViewdblclickok = False
Else
tvTreeViewdblclickok = True
End If
End Sub
Private Sub tvTreeView_NodeClick(ByVal Node As MSComctlLib.Node)
Dim SSql As String
If Node.Tag <> "" Then
If Node.Tag = False Then
SSql = "SELECT * FROM xt_xtgnb where sjgnbm='" + Mid(Trim(tvTreeView.SelectedItem.Key), 2, Len(Trim(tvTreeView.SelectedItem.Key)) - 1) + "' and MenuList=1 order by gnbm"
If sjgnbmStr = Mid(Trim(tvTreeView.SelectedItem.Key), 2, Len(Trim(tvTreeView.SelectedItem.Key)) - 1) Then
Exit Sub
Else
sjgnbmStr = Mid(Trim(tvTreeView.SelectedItem.Key), 2, Len(Trim(tvTreeView.SelectedItem.Key)) - 1)
End If
Else
SSql = "SELECT * FROM xt_xtgnb a," _
& "(SELECT sjgnbm FROM xt_xtgnb where gnbm='" + Mid(Trim(tvTreeView.SelectedItem.Key), 2, Len(Trim(tvTreeView.SelectedItem.Key)) - 1) + "')b" & " where a.sjgnbm=b.sjgnbm and MenuList=1 order by gnbm"
End If
Set Xtgnbrec = Cw_DataEnvi.DataConnect.Execute(SSql)
If Node.Tag = True Then
If sjgnbmStr = Trim(Xtgnbrec!sjgnbm) Then
Exit Sub
Else
sjgnbmStr = Trim(Xtgnbrec!sjgnbm)
End If
End If
lvListView.ColumnHeaders.Clear
lvListView.ListItems.Clear
lvListView.ColumnHeaders.Add 1, "rcsw", "明细", 3000, , "stb"
Do While Not Xtgnbrec.EOF
Set mitem = lvListView.ListItems.Add()
mitem.Text = Trim(Xtgnbrec!gnmc)
If Xtgnbrec.Fields("mjbz") Then
mitem.SmallIcon = "gnqx"
mitem.Icon = "y"
Else
mitem.Icon = "i"
mitem.SmallIcon = "stb"
End If
mitem.Key = "T" & Trim(Xtgnbrec!gnbm)
Xtgnbrec.MoveNext
Loop
End If
End Sub
Public Sub Cshgns() '初始化系统功能树
Set Xtgnbrec = Cw_DataEnvi.DataConnect.Execute("SELECT * FROM Xt_xtgnb a,gy_czygl b WHERE (a.gnbm LIKE '22%') AND (a.MenuList = 1) AND (b.czybm = '" & Xtczybm & "') ORDER BY a.gnbm")
tvTreeView.Nodes.Add , 4, "T", "宇迪光学/ERP2.00", "xttb"
With Xtgnbrec
Do While Not .EOF
If .Fields("mjbz") Then
Set nodX = tvTreeView.Nodes.Add("T" + Trim(.Fields("sjgnbm")), 4, "T" + Trim(.Fields("gnbm")), Trim(.Fields("gnmc")), "gnqx")
Else
If Trim(.Fields("sjgnbm")) = "" Then
Set nodX = tvTreeView.Nodes.Add("T" + Trim(.Fields("sjgnbm")), 4, "T" + Trim(.Fields("gnbm")), Trim(.Fields("gnmc")), "kpgl")
Else
Set nodX = tvTreeView.Nodes.Add("T" + Trim(.Fields("sjgnbm")), 4, "T" + Trim(.Fields("gnbm")), Trim(.Fields("gnmc")), "stb")
End If
End If
nodX.Tag = Xtgnbrec!mjbz
If Len(Trim(.Fields("sjgnbm"))) <= 2 Then
nodX.EnsureVisible
End If
.MoveNext
Loop
End With
End Sub
'系统功能树操作
Private Sub tvTreeView_BeforeLabelEdit(Cancel As Integer) '屏蔽编辑
Cancel = 1
End Sub
Private Sub tvTreeView_Collapse(ByVal Node As MSComctlLib.Node) '功能树收缩
If Node.Index <> 1 And Node.Key <> "T33" Then
Node.Image = "stb"
End If
End Sub
Private Sub tvTreeView_Expand(ByVal Node As MSComctlLib.Node) '功能树展开
If Node.Index <> 1 And Node.Key <> "T33" Then
Node.Image = "szk"
End If
End Sub
Private Sub tvTreeView_KeyPress(KeyAscii As Integer) '用户按回车键执行相应功能
If KeyAscii = vbKeyReturn Then
isLeftButton = True
tvTreeViewdblclickok = True
Call tvTreeView_DblClick
End If
End Sub
Private Sub tvTreeView_DblClick() '选择功能
If tvTreeViewdblclickok = False Then Exit Sub
If Not isLeftButton Then Exit Sub
If tvTreeView.SelectedItem.Children = 0 Then
Set Xtgnbrec = Cw_DataEnvi.DataConnect.Execute("SELECT * FROM xt_xtgnb where gnbm='" + Mid(Trim(tvTreeView.SelectedItem.Key), 2, Len(Trim(tvTreeView.SelectedItem.Key)) - 1) + "'")
If Not Xtgnbrec.EOF Then
gnsyte = Trim(Xtgnbrec.Fields("gnsy"))
Call Zxxymk(gnsyte)
End If
End If
End Sub
Public Sub Zxxymk(gnsy As String) '根据用户选择执行相应程序
Dim Rectemp As New ADODB.Recordset '临时使用动态集
Dim Sqlstr As String '临时查询字符串
If Len(Trim(gnsy)) = 0 Then
Exit Sub
End If
On Error GoTo Cwcl:
Select Case gnsy
'文件
Case "Gy_register" '用户重新注册
SaveSetting Ebo_gsProductName, Ebo_gsPrjName, "login_mode", "30"
Timer1.Interval = 10
Timer1.Enabled = True
Shell App.Path & "\YdErp2008.exe", vbNormalFocus
Case "Gy_quit"
Unload XT_Main
'功能
Case "XT_scgl_LL01" '领料登记_普通
If Not Security_Log("XT_scgl_LL01", Xtczybm, 1, True) Then
Exit Sub
End If
FrmLldj01.Show
Case "XT_scgl_LL02" '领料登记_镀膜
If Not Security_Log("XT_scgl_LL02", Xtczybm, 1, True) Then
Exit Sub
End If
FrmLldj02.Show
Case "XT_scgl_ZJ01" '质检登记_普通
If Not Security_Log("XT_scgl_ZJ01", Xtczybm, 1, True) Then
Exit Sub
End If
Frmzjdj01.Show
Case "XT_scgl_ZJ02" '质检登记_镀膜
If Not Security_Log("XT_scgl_ZJ02", Xtczybm, 1, True) Then
Exit Sub
End If
Frmzjdj02.Show
Case "XT_scgl_CL01" '产量报表_普通
If Not Security_Log("XT_scgl_CL01", Xtczybm, 1, True) Then
Exit Sub
End If
FrmCl01.Show
Case "XT_scgl_CL02" '产量报表_镀膜
If Not Security_Log("XT_scgl_CL02", Xtczybm, 1, True) Then
Exit Sub
End If
FrmCl02.Show
'*********************************************
Case "Gy_gnbmjsq" '计算器
Shell App.Path & "\calc.exe", vbNormalFocus
Case "Gy_gnbmjsb" '记事本
Shell App.Path & "\Notepad.exe", vbNormalFocus
'帮助
Case "Gy_xtbz" '系统帮助
Call F1bz
Case "Gy_gy" '关于
XT_frmAbout.Show 1
End Select
'用户退出时写上机日志
Security_Log gnsy, Xtczybm, 2, False
Exit Sub
Cwcl:
Tsxx = "此项系统功能有待完善!"
Call Xtxxts(Tsxx, 0, 4)
Exit Sub
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) '用户关闭窗体
If Unload_TF = False Then
Cancel = 1
Me.WindowState = 1
End If
End Sub
Private Sub Form_Load()
'设置窗体图标
Me.Icon = XT_Main.Icon
'设置窗体位置大小,并调入系统功能树
Me.Left = 0
Me.Top = 0
Me.Width = XT_Main.Width - 60
Me.Height = XT_Main.Height - 760 - 690
Call Cshgns
'启动调入数据等待提示
Load Xt_Wait
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
Dim i As Integer
For i = Forms.Count - 1 To 1 Step -1
Unload Forms(i)
Next
If Me.WindowState <> vbMinimized Then
SaveSetting App.Title, "Settings", "MainLeft", Me.Left
SaveSetting App.Title, "Settings", "MainTop", Me.Top
SaveSetting App.Title, "Settings", "MainWidth", Me.Width
SaveSetting App.Title, "Settings", "MainHeight", Me.Height
End If
SaveSetting App.Title, "Settings", "ViewMode", lvListView.View
End Sub
Private Sub Form_Resize()
On Error Resume Next
If Me.Width < 3000 Then Me.Width = 3000
SizeControls imgSplitter.Left
End Sub
Private Sub imgSplitter_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
With imgSplitter
picSplitter.Move .Left, .Top, .Width \ 2, .Height - 20
End With
picSplitter.Visible = True
mbMoving = True
End Sub
Private Sub imgSplitter_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim sglPos As Single
If mbMoving Then
sglPos = x + imgSplitter.Left
If sglPos < sglSplitLimit Then
picSplitter.Left = sglSplitLimit
ElseIf sglPos > Me.Width - sglSplitLimit Then
picSplitter.Left = Me.Width - sglSplitLimit
Else
picSplitter.Left = sglPos
End If
End If
End Sub
Private Sub imgSplitter_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
SizeControls picSplitter.Left
picSplitter.Visible = False
mbMoving = False
lvListView.Refresh
End Sub
Sub SizeControls(x As Single)
On Error Resume Next
'设置 Width 属性
If x < 3500 Then x = 3500
If x > (Me.Width - 1500) Then x = Me.Width - 1500
tvTreeView.Width = x
imgSplitter.Left = x
lvListView.Left = x + 40
lvListView.Width = Me.Width - (tvTreeView.Width + 140)
lblTitle(0).Width = tvTreeView.Width
lblTitle(1).Left = lvListView.Left + 20
lblTitle(1).Width = lvListView.Width - 40
'设置 Top 属性
tvTreeView.Top = tbToolBar.Height + picTitles.Height
lvListView.Top = tvTreeView.Top
'设置 height 属性
tvTreeView.Height = Me.ScaleHeight - (picTitles.Top + picTitles.Height)
lvListView.Height = tvTreeView.Height
imgSplitter.Top = tvTreeView.Top
imgSplitter.Height = tvTreeView.Height
End Sub
Private Sub tbToolBar_ButtonClick(ByVal Button As MSComctlLib.Button)
On Error Resume Next
Select Case Button.Key
Case "返回"
tvTreeView.SetFocus
SendKeys "{up}", True
Case "向前"
tvTreeView.SetFocus
SendKeys "{DOWN}", True
Case "大图标"
lvListView.View = lvwIcon
Case "小图标"
lvListView.View = lvwSmallIcon
Case "列表"
lvListView.View = lvwList
Case "详细资料"
lvListView.View = lvwReport
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -