📄 判断控件属于sstab的哪一页.txt
字号:
以 下 办 法 不 知 是 否 满 足 这 位 朋 友 的 要 求 ? 请 指 正 。
Dim MyObj as Object
Dim TabID
Set Myobj=Text1.Container
TabID=MyObj.Tab
<END>
案
First, I am sorry that I don't have a Chinese editor. That means I have to answer this in English.
The Left property of controls on the inactive tab of the sstab is set to itsself - 75000 so use the following function can get the tab number of the sstab:
Public Function TabNumber(Control As Control) As
Integer
Dim intCurrentTab As Integer
Dim intSearchTab As Integer
Control.Container.Visible = False
intCurrentTab = Control.Container.Tab
For intSearchTab = 0 To Control.Container.Tabs - 1
Control.Container.Tab = intSearchTab
If Control.Left > -100 Then
Control.Container.Tab = intCurrentTab
Control.Container.Visible = True
TabNumber = intSearchTab
Exit Function
End If
Next intSearchTab
Control.Container.Tab = intCurrentTab
Control.Container.Visible = True
TabNumber = -1
End Function
but the side effict this function will fire the click event of the sstab control. I believe that you can use the basic thinking of this function to do your automation.
<END>
在 SSTAB中 的 第 一 个 页 面 加 控 件 1, 第 二 个 页 面 加 控 件 2。
然 后 判 断 :
if 控 件 1.left>0 then
msgbox "第 一 个 页 面 打 开 "
else
if 控 件 2.left>0 then
msgbox "第 二 个 页 面 打 开 "
end if
end if
注 : 非 激 活 的 页 面 , 其 上 的 所 有 控 件 的 left都 小 于 零 。
<END>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -