2011-08-16 45 views
0

如何設置WinForms ToolTip中文本的最大長度? 我有大約300個字符字符串,但我的工具提示只顯示其中的264 ...WinForms ToolTip中的文本長度

映入眼簾,

于爾根

+1

你是如何設置的提示?我複製並粘貼了3次消息,使其長度爲424字節(3行),所有3行顯示出來。我所做的只是在表單上放置文本框和工具欄,併爲文本框設置工具提示文本。 –

回答

3

你可以在你的工具提示添加NEWLINE幾次像這樣的字符串,以便它不會一直穿過屏幕。

此代碼中的字符串長度爲434個字符。

:-)

只需運行該代碼嘗試它,請:>>

Imports System.Environment 

Public Class Form1 

    Friend WithEvents myToolTip As New ToolTip 

    Private Sub Form1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseHover 

     Dim someText As String = _ 
     "Hello World!! Hi everyone!! Good day, good evening or goodnight, wherever you are in the world!! :-) :-D" & NewLine & _ 
     "Hello World!! Hi everyone!! Good day, good evening or goodnight, wherever you are in the world!! :-) :-D" & NewLine & _ 
     "Hello World!! Hi everyone!! Good day, good evening or goodnight, wherever you are in the world!! :-) :-D" & NewLine & _ 
     "Hello World!! Hi everyone!! Good day, good evening or goodnight, wherever you are in the world!! :-) :-D" 

     Me.Text = someText.Length.ToString 
     myToolTip.Show(someText, Me, 5000) 

    End Sub 

End Class