问题
I'm building an application and I have a TextBox
control that is filled with a value. On some occasions the control is too small and I don't have the space to expand it.
How do you show the TextBox
content on hover when the control is too small?
回答1:
Add a tooltip to the form and the following code
Private Sub TextBox1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.MouseHover
ToolTip1.SetToolTip(TextBox1, TextBox1.Text)
End Sub
回答2:
This has the same answer as this question: Showing Textbox ToolTip
Private _toolTip As New ToolTip()
Private Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As EventArgs) _
Handles TextBox1.TextChanged
_toolTip.Show(TextBox1.Text, TextBox1)
End Sub
来源:https://stackoverflow.com/questions/38244139/textbox-string-as-tooltip-on-hover