本文介绍了显示扩展/折叠的工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,专家,

我是vb.net的新手.我正在使用按钮来展开/折叠面板.此按钮用于显示/隐藏包含其他按钮的面板.我希望有一个工具提示在面板隐藏时显示展开面板",在面板显示时显示折叠面板".

以下是我尝试过的代码.

Hi experts,

I''m new to vb.net. I''m using a button to expand/collapse a panel. This button is used to show/hide a panel contains some other buttons. I want to have a tooltip to show "Expand Panel" when panel hides and "Collapse Panel" when the panel shown.

Below is the code which I tried out.

Private Sub Expand_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button.MouseHover
       Dim toolTip As New ToolTip()
       toolTip.SetToolTip(Me.Button, "")

       If Not Me.Expanded Then
           toolTip.SetToolTip(Me.Button, "Expand")
       Else
           toolTip.SetToolTip(Me.Button, "Collapse")
       End If
   End Sub



现在的问题是,如果将鼠标悬停在按钮上,则工具提示文本会相互重叠.有时我们可以在更改为折叠面板"之前看到扩展面板"文本.

有人对此有建议吗?

谢谢,
骷髅头

[已删除伪造的c#标签]



The problem now is the tooltip text are overlapping each other if hover over the button. And sometimes we can see the text "Expand Panel" before it change to "Collapse Panel".

Anyone have suggestion on this?

Advanced thanks,
Skundhead

[Removed fake c# tag]

推荐答案

Private Sub Expand_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button.MouseHover
    Dim toolTip As New ToolTip()
    toolTip.SetToolTip(Me.Button, "")
    If Not Panel1.Visible = True Then
        toolTip.SetToolTip(Me.Button, "Expand")
    Else
        toolTip.SetToolTip(Me.Button, "Collapse")
    End If
End Sub


这篇关于显示扩展/折叠的工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 05:40