📄 +
字号:
Private Sub Lrzdbz() '录入字段帮助
If Not Ydcommand.Visible Then
Exit Sub
End If
With WglrGrid
Valilock = True
'处理通用部分
changelock = True '调入另外窗体必须加锁
Call Drbmhelp(GridInt(.Col, 6), GridStr(.Col, 3), Trim(Ydtext.Text))
changelock = False
If Len(Xtfhcs) <> 0 Then
If GridInt(.Col, 7) = 0 Then
Ydtext.Text = Xtfhcs
Else
Ydtext.Text = Xtfhcsfz
End If
End If
Valilock = False
If Ydtext.Visible Then
Ydtext.SetFocus
End If
End With
End Sub
Private Sub Form_Resize() '窗体大小发生变化时,重新显示文本框
Call Cxxswbk
End Sub
Private Function Fun_Drfrmyxxpd() As Boolean '调入其它窗体或功能产生的有效性判断(包括数据回写)
Fun_Drfrmyxxpd = True
With WglrGrid
'如果当前网格处于编辑状态,则先进行数据回写再进行有效性判断
If Ydtext.Visible Or YdCombo.Visible Then
Call Lrsjhx
If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
Fun_Drfrmyxxpd = False
Exit Function
End If
End If
'进行行有效性判断
If Not Sjhzyxxpd(.Row) Then
Fun_Drfrmyxxpd = False
Exit Function
End If
End With
End Function
Private Sub WglrGrid_EnterCell() '显示当前数据行相关信息
With WglrGrid
If .Row >= .FixedRows Then
'[>>
'此处可以填写显示与此网格行相关信息
'<<]
End If
End With
End Sub
Private Sub WglrGrid_GotFocus() '网格得到焦点
'网格得到焦点,如果当前选择行为非数据行
'则调整当前焦点至有效数据行
With WglrGrid
If .Row < .FixedRows And .Rows > .FixedRows Then
changelock = True
.Select .FixedRows, .Col
changelock = False
End If
If .Col < Qslz Then
changelock = True
.Select .Row, Qslz
changelock = False
End If
End With
End Sub
Private Sub WglrGrid_LostFocus() '录入网格失去焦点
'用以屏蔽调用其它窗体时发生网格失去焦点事件
If changelock Then
Exit Sub
End If
'引发网格RowcolChange事件
With WglrGrid
If Not (Ydtext.Visible Or YdCombo.Visible) Then
.Select 0, 0
End If
End With
End Sub
Private Sub WglrGrid_AfterScroll(ByVal OldTopRow As Long, ByVal OldLeftCol As Long, ByVal NewTopRow As Long, ByVal NewLeftCol As Long) '限制用户在录入过程中滚动鼠标
If Gdtlock Then
Exit Sub
End If
With WglrGrid
If Ydtext.Visible Or YdCombo.Visible Then
Gdtlock = True
.TopRow = Dqtoprow
.LeftCol = Dqleftcol
Gdtlock = False
Exit Sub
End If
End With
End Sub
Private Sub WglrGrid_LeaveCell() '离开单元格
If changelock Then
Exit Sub
End If
'记录刚刚离开网格单元的行列值
Dqlkwgh = WglrGrid.Row
Dqlkwgl = WglrGrid.Col
'判断是否需要录入数据回写
If Not (Ydtext.Visible Or YdCombo.Visible) Then
Exit Sub
End If
Call Lrsjhx
End Sub
Private Sub WglrGrid_RowColChange() '网格录入行列发生变化时,进行有效性判断
Valilock = True '屏蔽文本框失去焦点进行有效性判断
With WglrGrid
If changelock Then
Exit Sub
End If
If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
Exit Sub
End If
If .Row <> Dqlkwgh Then
If Not Sjhzyxxpd(Dqlkwgh) Then
Exit Sub
End If
End If
End With
Call fhyxh
Call Xldql
End Sub
Private Sub WglrGrid_DblClick() '鼠标双击网格显示文本框
'判断用户是否有此功能执行权限,如有则写上机日志(进入)
If Not Security_Log("Ar_CuseAcc_Edit", Xtczybm, 1, True) Then
Exit Sub
End If
With WglrGrid
Call xswbk
End With
End Sub
Private Sub Ycwbk() '隐藏文本框,帮助按钮,列表组合框
Valilock = True
Ydtext.Visible = False
YdCombo.Visible = False
Ydcommand.Visible = False
End Sub
Private Sub YdCombo_KeyDown(KeyCode As Integer, Shift As Integer) '列表框移动
With WglrGrid
Select Case KeyCode
Case vbKeyEscape 'ESC 键放弃录入
Valilock = True
.SetFocus
Call Ycwbk
Valilock = False
Case vbKeyReturn '回 车 键 =13
KeyCode = 0
.SetFocus
Call Lrsjhx
Rowjsq = .Row
Coljsq = .Col + 1
If Coljsq > .Cols - 1 Then
If Rowjsq < .Rows - 1 Then
Rowjsq = Rowjsq + 1
End If
Coljsq = Qslz
End If
Do While Rowjsq <= .Rows - 1
If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
Coljsq = Coljsq + 1
If Coljsq > .Cols - 1 Then
Rowjsq = Rowjsq + 1
Coljsq = Qslz
End If
Else
Exit Do
End If
Loop
.Select Rowjsq, Coljsq
Case vbKeyLeft '左 箭 头 =37
If .Col - 1 = Qslz Then
If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
GoTo jzzx
End If
End If
If .Col > Qslz Then
KeyCode = 0
.SetFocus
Call Lrsjhx
Coljsq = .Col - 1
Do While Coljsq > Qslz
If Coljsq - 1 = Qslz Then
If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
GoTo jzzx
End If
End If
If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
Coljsq = Coljsq - 1
Else
Exit Do
End If
Loop
.Select .Row, Coljsq
End If
Case vbKeyRight '右 箭 头 =39
KeyCode = 0
.SetFocus
Call Lrsjhx
Rowjsq = .Row
Coljsq = .Col + 1
If Coljsq > .Cols - 1 Then
If Rowjsq < .Rows - 1 Then
Rowjsq = Rowjsq + 1
End If
Coljsq = Qslz
End If
Do While Rowjsq <= .Rows - 1
If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
Coljsq = Coljsq + 1
If Coljsq > .Cols - 1 Then
Rowjsq = Rowjsq + 1
Coljsq = Qslz
End If
Else
Exit Do
End If
Loop
.Select Rowjsq, Coljsq
Case Else
End Select
jzzx:
End With
End Sub
Private Sub YdCombo_LostFocus() '列表框失去焦点
With WglrGrid '因为选中网格会先发生Rowcolchange事件置Valiock
If Not Valilock Then '为TRUE
Call Lrsjhx
If Not Sjhzyxxpd(Dqlrwgh) Then
Exit Sub
End If
End If
End With
End Sub
Private Sub Ydcommand_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Call Lrzdbz
End Sub
Private Sub ydtext_KeyDown(KeyCode As Integer, Shift As Integer)
Dim Rowjsq As Long, Coljsq As Long
With WglrGrid
Select Case KeyCode
Case vbKeyF2
Call Lrzdbz
Case vbKeyEscape 'ESC 键放弃录入
Valilock = True
Call Ycwbk
.SetFocus
Case vbKeyReturn '回 车 键 =13
KeyCode = 0
.SetFocus
Call Lrsjhx
Rowjsq = .Row
Coljsq = .Col + 1
If Coljsq > .Cols - 1 Then
If Rowjsq < .Rows - 1 Then
Rowjsq = Rowjsq + 1
End If
Coljsq = Qslz
End If
Do While Rowjsq <= .Rows - 1
If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
Coljsq = Coljsq + 1
If Coljsq > .Cols - 1 Then
Rowjsq = Rowjsq + 1
Coljsq = Qslz
End If
Else
Exit Do
End If
Loop
If Rowjsq <= .Rows - 1 Then
.Select Rowjsq, Coljsq
End If
Case vbKeyUp '上 箭 头 =38
KeyCode = 0
.SetFocus
Call Lrsjhx
If .Row > .FixedRows Then
.Row = .Row - 1
End If
Case vbKeyDown '下 箭 头 =40
KeyCode = 0
.SetFocus
Call Lrsjhx
If .Row < .Rows - 1 Then
.Row = .Row + 1
End If
Case vbKeyLeft '左 箭 头 =37
If .Col - 1 = Qslz Then
If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
GoTo jzzx
End If
End If
If Ydtext.SelStart = 0 And .Col > Qslz Then
KeyCode = 0
.SetFocus
Call Lrsjhx
Coljsq = .Col - 1
Do While Coljsq > Qslz
If Coljsq - 1 = Qslz Then
If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
GoTo jzzx
End If
End If
If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
Coljsq = Coljsq - 1
Else
Exit Do
End If
Loop
.Select .Row, Coljsq
End If
jzzx:
Case vbKeyRight '右 箭 头 =39
wblong = Len(Ydtext.Text)
If (Ydtext.SelStart = wblong Or Ydtext.SelLength = wblong) Then
KeyCode = 0
.SetFocus
Call Lrsjhx
Rowjsq = .Row
Coljsq = .Col + 1
If Coljsq > .Cols - 1 Then
If Rowjsq < .Rows - 1 Then
Rowjsq = Rowjsq + 1
End If
Coljsq = Qslz
End If
Do While Rowjsq <= .Rows - 1
If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
Coljsq = Coljsq + 1
If Coljsq > .Cols - 1 Then
Rowjsq = Rowjsq + 1
Coljsq = Qslz
End If
Else
Exit Do
End If
Loop
.Select Rowjsq, Coljsq
End If
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -