ElektroStudios
ElektroStudios

Reputation: 20464

How to create and show a infotip when clickng a label?

I'm using VSTUDIO2012, my problem seems simple but it's too hard for me,

EDIT: It's a "windows forms application"

I have a label and when i click at the label i want to show a little info in a "infotip" or "tooltip" or "ballontip", i want to show a message like for 5-10 seconds...

Someone can guide me about how to make this? or references on the web please?

EDIT2: I've tried this:

Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click

    'MessageBox.Show("Use the 'Ctrl+C' hotkey to copy the" & vbNewLine & "mouse coordinates into the clipboard.", "Mouse XY by Elektro H@cker")
End Sub

Private Sub ToolTip1_Popup(sender As Object, e As PopupEventArgs) Handles ToolTip1.Popup
    ToolTip1.Show("Tooltip text goes here", Label1)
End Sub

Upvotes: 0

Views: 643

Answers (1)

War10ck
War10ck

Reputation: 12508

When you start your application, you should your form you're working on in the center of the screen.

On the left side of the screen you should see a panel labeled 'Toolbox' (it may be on different sides of the screen depending on how you arrange your panels. I think default is left though. If you don't see it you can show it by selecting 'Toolbox' from the view menu or by pressing "Ctrl + Alt + X".).

With the 'Toolbox' panel open, you should see several collapsible panels. Open either 'All Windows Forms' or 'Common Controls'. Near the bottom of each collapsible area is an element you can add labeled 'ToolTip'. Once its been added successfully, a light gray control panel appears with your new ToolTip control labeled 'ToolTip1'.

Once the control is added you simply right click on an element that you want to add a tooltip to such as a label. When the popup context menu appears choose 'Properties' (the very last option). This opens the Properties Panel.

When the Properties Panel opens, scroll to the bottom of the list. Right below the TextAlign Property should be a property called ToolTip on ToolTip1. Enter your tooltip text here. Now when a user hovers over your label, the text entered will appear in a standard yellowish popup tooltip.

Upvotes: 1

Related Questions