Bunifu ToolTip
Last updated
Last updated
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:
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 behavior and appearance:
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:
To implement and apply a Bunifu ToolTip for controls programmatically, use the SetToolTip method. Here's an example:
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.
Here is an example where once a user clicks on a Bunifu Button, a ToolTip appears in the Bunifu Image Button we already added to our Form:
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 behavior is as shown below:
Units for time are in milliseconds
Let's take a look at these additional features...
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.
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 (), Italic (), Underline (), 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:
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":
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 ClickToShowDisplayControl
to true
.
Here's some sample code:
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:
Active
: Gets or sets a value indicating whether the ToolTip is active. ToolTips will only appear if this property is set to true
.
ConvertNewlinesToBreakTags
: Gets or sets a value indicating whether to allow conversion of newline characters in content to HTML break tags.
ShowAlways
: Determines if the tool tip will be displayed always, even when the parent window is not active.
ShowIcons
: Gets or sets a value indicating whether the ToolTip will. display icons if the associated control or controls have specified one.
OverrideToolTipTitles
: When set to true, all ToolTip Titles set in each control will be replaced with the default ToolTipTitle
provided.
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.
ShowShadows
: Gets or sets a value indicating whether display-shadows will be provided around the ToolTip's borders.
ShowBorders
: Gets or sets a value indicating whether standard borders will be drawn around the ToolTip's region.
AllowFading
: When set to true, a fade effect is used when ToolTips are shown or hidden.
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.
Padding
: Gets or sets the ToolTip's inner padding between the container and its content, that is, the Title
and Text
information.
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 true
.
Opacity
: Gets or sets the opacity of transparency-level of the ToolTip.
InitialDelay
: Gets or sets the length of time, in milliseconds, it takes before the ToolTip is shown.
ReshowDelay
: Gets or sets the length of time, in milliseconds, it takes before subsequent ToolTips are shown.
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.
EntryAnimationSpeed
: Gets or sets the ToolTip's entry animation speed in milliseconds.
ExitAnimationSpeed
: Gets or sets the ToolTip's exit animation speed in milliseconds.
IconMargin
: Gets or sets the margin (distance) between the ToolTipIcon
and ToolTipTitle
.
TextMargin
: Gets or sets the ToolTipText
margin, that is, the distance between the ToolTipTitle
and the ToolTipText
.
BackColor
: Gets or sets the ToolTip's background color.
BoderColor
: Gets or sets the ToolTip's border color.
TitleForeColor
: Gets or sets the ToolTip's Title ForeColor.
TextForeColor
: Gets or sets the ToolTip's Text ForeColor.
TitleFont
: Gets or sets the ToolTip's Title Font.
TextFont
: Gets or sets the ToolTip's Text Font.
Visible
: Determines if the ToolTip is currently visible.
DisplayControl
: Gets or sets a control that will be displayed in the ToolTip in-place of the standard ToolTip's view.
ClickToShowDisplayControl
: Gets or sets a value indicating whether the attached DisplayControl
will be displayed once a user clicks on the associated ToolTip control.
ToolTipPosition
: Gets or sets the ToolTip's position within the client region.
Show
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
Hide()
: Hides the ToolTip when displayed in any associated control(s).
RemoveALl
RemoveAll()
: Removes all the applied ToolTips currently associated with the ToolTip component.
CanExtend
CanExtend(object extendee)
: Returns true if the ToolTip can offer an extender property to the specified target component.
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.