Introduction
This is a fully customizable ToolTip that inherits from the standard one. This work was my cornerstone in this project: http://www.codeproject.com/Articles/464085/WinForms-RichTextBox-ToolTip-like-Visual-Studios. Therefore, I didn't want to be a 'tightwad' and decided to share the whole project with you, guys ;)
The new features, the ability of customizing the ToolTip's:
- Title color.
- Title font.
- Description color.
- Description font.
- Background image.
How to use the component
- Right click on the Visual Studio ToolBox.
- On the ".NET Framework Components" tab click on "Browse..." button.
- Browse to the DLL file and select it.
- On the ToolBox a new component will be added with "
eToolTip
" name.
Now add your new component to any form and for the properties they are accessible from both: the
DesignerEditor
and CodeEditor
as well.
How does it work?
The component relies on the 'OnPopup
' and 'OnDrawn
' events to customize the ToolTip. How?
OnPopup
event:
Measuring the appropriate size that will fit with the both of title and description.
OnDrawn
event:
- First thing here that the event will start with is resizing the specified
BackgroundImage
according to the ToolTip size and then drawing the background image.
- From the measured size the event will determine the appropriate way of drawing the text according to the ToolTip measured size.
- When drawing a text on the ToolTip using the '
e.Graphics.DrawString()
' method, this method needs a specific brush and font for the string that will be drawn,
so the event is set to use the specified brush and font from the specified properties for each of
Title
and Description
of the component.