check this out
Public Function SetWidth(ByVal str As String, ByVal fnt As Font, ByVal width As Integer) As String
Dim rstr As String = Environment.NewLine & str
Dim pos As Integer = 1
Dim pos2 As Integer
While pos < str.Length
pos = InStr(pos, rstr, " ") + 1
If pos = 1 Then
pos2 = InStrRev(rstr, Environment.NewLine, pos)
If Me.CreateGraphics.MeasureString(Mid(rstr, pos2, pos - pos2 + 1), fnt).Width > width Then
rstr = rstr.Insert(InStrRev(rstr, " ", pos - 1), Environment.NewLine)
Return Mid(rstr, 2, rstr.Length - 1)
this will wrap ur tooltip and display it properly
Check this out
<a href="http://nemerle.org/wiki/index.php?title=System.Windows.Forms_tutorial">http://nemerle.org/wiki/index.php?title=System.Windows.Forms_tutorial</a>[<a href="http://nemerle.org/wiki/index.php?title=System.Windows.Forms_tutorial" target="_blank" title="New Window">^</a>]
<a href="http://allapi.mentalis.org/apilist/GetWindowTextLength.shtml">http://allapi.mentalis.org/apilist/GetWindowTextLength.shtml</a>[<a href="http://allapi.mentalis.org/apilist/GetWindowTextLength.shtml" target="_blank" title="New Window">^</a>]
<This is too long for a comment.>
The TitleBar Text of a Form is not intended to be a feedback mechanism for presenting information, and the idea of truncated Text, in the TitleBar, which then, must, somehow, be expanded: is not good UI design in general, and will be quite confusing to users of your application.
The idea of a ToolTip appearing that shows the full-text of a TitleBar (where the TitleBar text is so long that it is truncated by the width of the Form):
Whether it's your own idea, or a requirement for work, or whatever, is:
A very bad idea; it violates the whole "visual tradition" of Windows' applications' "look and feel" (at least until we get to Modern/Metro, where all our previous MS UI experience is thrown under the bus) as expressed in the Microsoft Windows Style guides.
The TitleBar text of a Form should display text that expresses what a Form is for, or what it does, or the name the user gave it when they created it:
In the case of multiple, identical Forms, created at run-time: perhaps Form title-text can be followed by an identifying number, to help users keep track of which Form they are using.
Having the TitleBar title change its text during run-time, if that's what you are describing is going to happen when your application runs: is just bizarre.
Automatically scrolling text in a StatusBar is also strange, but, I have seen it done, and a StatusBar is, by design, one control used to present changing summary information.
Windows' users are socialized over years to certain expected visual style and behavior of applications, and their windows (although the game is about to change with Modern/Metro coming):
In general, you want to make it easy for a new user of your application to "leverage" what they already know in using your application:
For now, I strongly suggest you use traditional design ... unless, of course, you are writing a game in which case you can invent whatever weirdness you desire :)
Even within traditional design: you can create custom-shaped Forms, Forms that can be moved that don't have a title-bar, Forms that have custom title-bars:
CP is full of articles describing all kinds of Form modification techniques.
And, if you have Aero available, you can use "glass" and its other various Form decorations, or simulate them (until Win 8 comes, that is).
You have some interesting answers here, and, in the past, I coded-up a ToolTip that displays only when the mouse is over the TitleBar area (the non-client area) of a Form:
AlbertDC gives you a vague hint at how to do that below: it involves writing a WndProc, but there's a much better way to write that WndProc:
And, it is damn tricky to make a WndProc invoked PopUp not flicker, and not to get an occasional "ghost" of a Pop-Up when you don't expect it, after you have hidden it. Not recommended, particularly for newcomers to WinForms, and I never use that code myself anymore, having decided it added no value to my WinForms programming !
Sure, use a Pop-Up, that can be as big as you like, when you mouse over some little icon (like a "help icon") on a Form, or when the user performs some kind of action.
Even consider using other Forms, just to present whatever big chunks of text information you want to give the user. Align them with an edge of the Form you wish them to provide information on: very easy to do.
Show a helper-Form modally, if you really feel the situation involves an issue that warrants "freezing" the use of your application: until the end-user makes a choice.
Or, don't show an information-presenting Form modally: let it persist until the user decides to close it, while the user continues using the your application and its other window(s). If the user moves the main Form, make your helper-Form track it and align again to its edge: easy to achieve !
Or, use a Timer to make helper-Forms, shown non-modally; after they have been made visible: then, fade them out by decreasing their opacity, in the Timer's Tick Event; then close them when they are totally transparent.
In other words: you can make your own Pop-Up equivalents that are not constrained by the boundaries of the Form they are used to provide information about (as long as you don't do something foolish, like making the main Form their Owner).