|
用Debug.Print方法检查你的几个变量,也只有两种组合,没有发现2楼说的位移的现象。
不过,设置left和width两个变量,用来调整fsbPD的位置,就没有问题:
Private Sub Cmd收展_Click()
'On Error GoTo Err_Cmd收展_Click
'Dim SubLeft As Long
'Dim TreeViewLeft As Long
Dim xxleft
Dim xxwidth
If Me.Cmd收展.Caption = "<<" Then
xxleft = TREEVIEW.Left
xxwidth = fsbPD.Width + fsbPD.Left - TREEVIEW.Left
Me.TREEVIEW.Visible = False
' KaLeft = Me.选项卡控件20.Left
'PageLeft = Me.配电线路.Left
' SubLeft = Me.fsbPD.Left
' SubWidth = Me.fsbPD.Width
' Me.fsbPD.Left = Me.TREEVIEW.Left
'Me.选项卡控件20.Left = 5
'Me.fsbPD.Width = Me.InsideWidth - 50
' Me.fsbPD.Width = Me.fsbPD.Width + SubLeft - Me.TREEVIEW.Left
Me.Cmd收展.Caption = ">>"
Me.fsbPD.Left = xxleft
Me.fsbPD.Width = xxwidth
'Me.选项卡控件20.Left = xxleft - 50
Else
xxleft = TREEVIEW.Left + TREEVIEW.Width + 100
xxwidth = fsbPD.Width - TREEVIEW.Width - 100
' Me.fsbPD.Left = SubLeft
' Me.fsbPD.Width = SubWidth
' Me.选项卡控件20.Left = KaLeft
'Me.选项卡控件20.Left = 6240
Me.TREEVIEW.Visible = True
Me.Cmd收展.Caption = "<<"
Me.fsbPD.Left = xxleft
Me.fsbPD.Width = xxwidth
'Me.选项卡控件20.Left = xxleft - 50
End If
Debug.Print Me.fsbPD.Left
Debug.Print Me.fsbPD.Width
Debug.Print " "
'Exit_Cmd收展_Click:
' Exit Sub
'Err_Cmd收展_Click:
' MsgBox Err.Description, , ""
' MsgBox "出错,重启。", , ""
' DoCmd.Close
' DoCmd.OpenForm "窗体1"
' Resume Exit_Cmd收展_Click
End Sub
|
|