Bunifu ToolTip is an elegantly new and unique way of providing "content-over-control" capabilities when needing to display extra information for controls, features, and more. It is a total rewrite of the standard Windows Forms ToolTip yet incorporating some of its features for consistency within the .NET Ecosystem.
Here's a preview of Bunifu ToolTip in action:
Adding Bunifu ToolTips at Design Time
To add a Bunifu ToolTip at design-time, simply locate the BunifuToolTip component from the Toolbox, then drag it to your Form or User Control.
Once you drag-and-drop the component, you'll see it placed down below the components area - from there, you can move n to click the small Play button at the right corner of the component to easily change its properties:
You can likewise go to the Properties section to fully customize its behaviour and appearance:
Setting a control's ToolTip at Design Time
Once you've added the ToolTip to your Form or User Control, the required properties will be included in all of the available controls.
You can then go ahead and set the properties provided in any control. Here' we will use a Bunifu Image Button as an example:
Now let's run our sample Windows Forms project:
As a quick tip, if you've categorized your Properties as shown in the example, you can easily navigate to where you'll see the Bunifu ToolTip: Properties section; there you'll find the properties available for every control added in your Form or User Control. You can however also navigate to where you will see the same listed properties as shown above, namely (beginning with), ToolTip on BunifuToolTip..., ToolTipIcon on BunifuToolTip..., and ToolTipTitle on BunifuToolTip...
Also note that the above names of each Bunifu ToolTip added have not been specified. In C#, for example, the naming is usually (by default) in camel-case format, e.g. bunifuToolTip while in VisualBasic, the naming is usually in pascal-case format, e.g. BunifuToolTip. For beginners, this format will guide you in determining where to find the properties if you happen to get lost.
Let's now proceed to setting the Bunifu Image Button's ToolTip Title and Icon properties:
That's it! We can then run our project...
If, for example, you would prefer to change the Title's font, this you can do simply by selecting the ToolTip and going to the Properties section, then choose a font from the TitleFont property. You can also do the same by accessing the ToolTip's Smart Tags:
As shown in the short illustration, we have changed the ToolTip's Title font to Rosemary while maintaining our ToolTip's Text font.
Here's what it will look like once we run our project:
Usage in code-view
To implement and apply a Bunifu ToolTip for controls programmatically, use the SetToolTip method. Here's an example:
// "bunifuImageButton1" is the control to display the ToolTip.
bunifuToolTip1.SetToolTip(bunifuImageButton1, "This is my first tooltip!");
// You can also set the ToolTip Title and/or Icon property.
// bunifuToolTip1.SetToolTipTitle(bunifuImageButton1, "Hello there...");
// bunifuToolTip1.SetToolTipIcon(bunifuImageButton1, Image.FromFile("c:\\icon.png"));
' "bunifuImageButton1" is the control to display the ToolTip. BunifuToolTip1.SetToolTip(BunifuImageButton1, "This is my first tooltip!")
' You can also set the ToolTip Title and/or Icon property.
' BunifuToolTip1.SetToolTipTitle(BunifuImageButton1, "Hello there...")
' BunifuToolTip1.SetToolTipIcon(BunifuImageButton1, Image.FromFile("c:\icon.png"))
You may find yourself in a situation where you need to display a ToolTip to a control once an action is performed such as clicking a Button. In such cases, the Bunifu ToolTip's Show method comes in handy. With this method, you can display ToolTips on controls without the need of doing so at design-time.
private void bunifuButton1_Click(object sender, EventArgs e)
// Set a ToolTip for the added Bunifu Image Button.
bunifuToolTip1.Show(bunifuImageButton1, "This is my first tooltip!");
Private Sub BunifuButton1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles BunifuButton1.Click
' Set a ToolTip for the added Bunifu Image Button.
BunifuToolTip1.Show(BunifuImageButton1, "This is my first tooltip!")
Now let's see the above code in action:
You can also choose to allow auto-closing the ToolTip after a period of time has reached using the property AllowAutoClose. This, together with the property AutoCloseDuration allow you to set flexible time-limits for hiding the ToolTip if shown.
Here is an example with the property AllowAutoClose enabled and the property AutoCloseDuration set to the default 5000 (the unit is in milliseconds):
The code for the above behaviour is as shown below:
bunifuToolTip1.AllowAutoClose = true;
// Units for time are in milliseconds.
bunifuToolTip1.AutoCloseDuration = 5000;
BunifuToolTip1.AllowAutoClose = True
' Units for time are in milliseconds.
BunifuToolTip1.AutoCloseDuration = 5000
More formatting options
You can highly customize Bunifu ToolTips to your taste. From changing the colors, to styling the ToolTip's content using HTML/CSS properties, to even providing your own Custom Control as the ToolTip's view rather than the default view...
Here's an example:
Let's take a look at these additional features...
1) Color properties
Below are the color-properties provided in Bunifu ToolTips:
- BackColor: Sets the ToolTip's background color.
- BorderColor: Sets the ToolTip's border color.
- TitleForeColor: Sets the ToolTip's title-fore-color.
- TextForeColor: Sets the ToolTip's text-fore-color.
2) HTML formatting
With Bunifu ToolTip comes HTML content-formatting, meaning that you can fully format the Title and Text content with both HTML Tags such as Bold (<b>), Italic (<i>), Underline (<u>), and inline CSS properties such as color, background-color, font-family, and font-size properties.
Here's an illustration of our previous example, now including some HTML:
Here's a final preview of the above illustration in action:
3) Alternative ToolTip Display Control
Here's a great addition... You may at times prefer to provide an alternative Control of your own to be displayed instead of the standard ToolTip provided. Well, with Bunifu ToolTip, you can...
Using the property DisplayControl, you can provide your own individual control whenever the ToolTip pops-up in-place of the default display. Since this property is not accessible from the Properties window, you'll need to access it via code-view.
Here's a sample code showing the implementation using a created Control named "MyUserControl":
bunifuToolTip1.DisplayControl = new MyUserControl();
BunifuToolTip1.DisplayControl = New MyUserControl()
Here's an illustration showing how to set a User Control as the ToolTip:
And here's a preview of the illustration in action:
At times, you may find the need to show your own User Control right after a user clicks on the associated ToolTip control. We'll, the same can be achieved simply by setting the property
Here's some sample code:
bunifuToolTip1.ClickToShowDisplayControl = true;
BunifuToolTip1.ClickToShowDisplayControl = True
With this feature, you can go a notch higher and allow your Display User Control to be shown only when the associated ToolTip control is clicked. This way, you will maintain the ToolTip to be displayed and your User Control. This can really come in-handy whenever you're working with Title Bar Icons.
Here's a preview of this feature in action:
Here's a list of the properties in Bunifu ToolTip:
(1) Active: Gets or sets a value indicating whether the ToolTip is active. ToolTips will only appear if this property is set to
(2) ConvertNewlinesToBreakTags: Gets or sets a value indicating whether to allow conversion of newline characters in content to HTML break tags.
(3) ShowAlways: Determines if the tool tip will be displayed always, even when the parent window is not active.
(4) ShowIcons: Gets or sets a value indicating whether the ToolTip will. display icons if the associated control or controls have specified one.
(5) OverrideToolTipTitles: When set to true, all ToolTip Titles set in each control will be replaced with the default
(6) AlignTextWithTitle: When set to true, the
ToolTipText will be aligned horizontally with the
ToolTipTitle 's position. This is especially useful whenever the ToolTipIcon is set.
(7) ShowShadows: Gets or sets a value indicating whether display-shadows will be provided around the ToolTip's borders.
(8) ShowBorders: Gets or sets a value indicating whether standard borders will be drawn around the ToolTip's region.
(9) AllowFading: When set to true, a fade effect is used when ToolTips are shown or hidden.
(10) AllowAutoClose: When set to true, the ToolTip will be closed automatically when a set period of time provided by the property
AutoCloseDuration , is given. However, when set to false, the ToolTip will be closed once the mouse leaves the associated control.
(11) Padding: Gets or sets the ToolTip's inner padding between the container and its content, that is, the
(12) ToolTipTitle: Gets or sets the global
ToolTipTitle to be implemented across all associated controls within the parent control. This feature will only be active whenever the property
OverrideToolTipTitles is set to
(13) Opacity: Gets or sets the opacity of transparency-level of the ToolTip.
(14) InitialDelay: Gets or sets the length of time, in milliseconds, it takes before the ToolTip is shown.
(15) ReshowDelay: Gets or sets the length of time, in milliseconds, it takes before subsequent ToolTips are shown.
(16) AutoCloseDuration: Gets or sets the length of time, in milliseconds, that the ToolTip will be displayed. This property is enabled whenever the property
AllowAutoClose is set to true.
(17) EntryAnimationSpeed: Gets or sets the ToolTip's entry animation speed in milliseconds.
(18) ExitAnimationSpeed: Gets or sets the ToolTip's exit animation speed in milliseconds.
(19) IconMargin: Gets or sets the margin (distance) between the ToolTipIcon and ToolTipTitle.
(20) TextMargin: Gets or sets the
ToolTipText margin, that is, the distance between the
ToolTipTitle and the
(21) BackColor: Gets or sets the ToolTip's background color.
(22) BoderColor: Gets or sets the ToolTip's border color.
(23) TitleForeColor: Gets or sets the ToolTip's Title ForeColor.
(24) TextForeColor: Gets or sets the ToolTip's Text ForeColor.
(25) TitleFont: Gets or sets the ToolTip's Title Font.
(26) TextFont: Gets or sets the ToolTip's Text Font.
(27) Visible: Determines if the ToolTip is currently visible.
(28) DisplayControl: Gets or sets a control that will be displayed in the ToolTip in-place of the standard ToolTip's view.
(29) ClickToShowDisplayControl: Gets or sets a value indicating whether the attached DisplayControl will be displayed once a user clicks on the associated ToolTip control.
(30) ToolTipPosition: Gets or sets the ToolTip's position within the client region.
Here's a list of the methods implemented in Bunifu ToolTip:
Show(Control[Control], Text[string], Optional:Title[string], Optional:Icon[Image], Optional:Location[Point]): Sets the ToolTip content to be associated with the specified control and displays the ToolTip.
Hide() : Hides the ToolTip when displayed in any associated control(s).
RemoveAll() : Removes all the applied ToolTips currently associated with the ToolTip component.
CanExtend(object extendee) : Returns true if the ToolTip can offer an extender property to the specified target component.
Here's a list of events implemented in Bunifu ToolTip:
Popup : Raised whenever the ToolTip is being shown. Includes the
PopupEventArgs event arguments for handling the associated Control and ToolTip.
Closed : Raised whenever the ToolTip is being closed.