Home
Search
ToolTip: Windows FormsUse the ToolTip control in Windows Forms. Review ToolTip properties.
C#
This page was last reviewed on Dec 24, 2022.
ToolTip. This control makes interfaces more intuitive. We add the ToolTip control to a Windows Forms application, which provides useful contextual hints to the client.
Getting started. We use Visual Studio to add ToolTips. First, to add a ToolTip control to your Windows Forms application, open the ToolBox panel in Visual Studio's designer.
Set ToolTip property. Once added, each control, such as Buttons and TextBoxes, will acquire a "ToolTip on toolTip1" property. We adjust this property to set ToolTip text.
Button Add a Button named button1 to the Windows Forms window in the Designer. This will now have the ToolTip property.
Next Select the Button in the Designer view. Scroll down to the ToolTip on toolTip1 row, and add some text.
ToolTip properties:
Active: This allows you to specify if the ToolTip is available to be opened or shown AutomaticDelay: This property allows you to specify the number of milliseconds after the user hovers over the ToolTip before it is shown AutoPopDelay: This property lets you specify how long in milliseconds a ToolTip will remain on the screen if the mouse is frozen BackColor, ForeColor: You can set the background and foreground of your ToolTip It is usually best to avoid changing these InitialDelay, ReshowDelay: These attributes let you specify the exact delays in milliseconds ToolTipIcon, ToolTipTitle: Allow you specify an image to display on the tooltip, and a title to display Animation, UseFading: These properties let you specify the visual effects used on your tooltips IsBalloon: You can specify a balloon tip with the IsBalloon property
Methods. It is possible and sometimes useful to write ToolTip code in C# code. Often, ToolTips that use IsBalloon will need to have custom C# or VB.NET code.
Tip The Show method forces the tip to be displayed. The Hide method forces a ToolTip to disappear.
And The Get and SetToolTip methods let you assign tooltips programmatically to controls.
A summary. Windows Forms programs have easy-to-use ToolTips. Ideally, you can implement your tips entirely in the Designer, keeping all the code out of your private implementation.
Dot Net Perls is a collection of tested code examples. Pages are continually updated to stay current, with code correctness a top priority.
Sam Allen is passionate about computer languages. In the past, his work has been recommended by Apple and Microsoft and he has studied computers at a selective university in the United States.
No updates found for this page.
Home
Changes
© 2007-2023 Sam Allen.