Windows 表单工具提示 属性 "ShowAlways" 在禁用父对象时不起作用

Windows forms ToolTip property "ShowAlways" not working when parent object is disabled

根据 Microsoft 开发人员文档,有一个 ToolTip property called ShowAlways 根据文档;

With the ShowAlways property, you can display a ToolTip window even when the container of the ToolTip is not active. You can use this feature in a modeless window application to enable ToolTip windows to be displayed regardless of which modeless window is active.

使用下面的示例代码我无法完成这项工作。

$Form                            = New-Object system.Windows.Forms.Form
$Form.ClientSize                 = '200,100'
$Form.text                       = "test"
$Form.TopMost                    = $false
$Form.FormBorderStyle            = 'FixedDialog'
$Form.MaximizeBox                = $false
$Form.StartPosition              = 'CenterScreen'

$checkbox1                       = New-Object system.Windows.Forms.CheckBox
$checkbox1.text                  = "Test"
$checkbox1.AutoSize              = $true
$checkbox1.width                 = 100
$checkbox1.height                = 20
$checkbox1.location              = New-Object System.Drawing.Point(10,50)
$checkbox1.Font                  = 'Verdana,7'

#Disable checkbox enabled state
$checkbox1.Enabled               = $false

$tooltip1                        = New-Object System.Windows.Forms.ToolTip
#Showalways property to true
$tooltip1.ShowAlways             = $true
$tooltip1.SetToolTip($checkbox1,"This is a tooltip.")
$Form.controls.AddRange($checkbox1)

$Form.ShowDialog()

我是不是漏掉了什么?

我最终从复选框中删除了文本并将其替换为标签,以便我可以在其上使用工具提示,并在启用复选框状态时向 QoL 标签添加 OnClick 操作。

也许它不是最好和最漂亮的解决方案,但它是一个可以工作并完成工作的解决方案,直到(或如果)禁用的复选框将来支持工具提示。