rabbitt
rabbitt

Reputation: 2598

Achieve tooltip like this in VB.net?

I found this tooltip that pops up in MS Word 2010 when someone enters a copy count above 32767, I would like to know how (and if) it is possible to implement a tooltip such as this within a VB.net windows form application.

tooltip screenshot MSWord 2010

Upvotes: 5

Views: 1573

Answers (2)

Steven0100
Steven0100

Reputation: 73

I tried the Balloon, but it was unpredictable as to which way it was orientated. However, the following code might get you started... I assume it's not bullet proof so you might need to add some more code.

I used a textbox and a tooltip from the tools menu:

Private Sub TextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles      TextBox1.TextChanged

If Val(TextBox1.Text) > 100 Then
        ToolTip1.Active = True
        ToolTip1.Show("Value is to Large", sender, New Drawing.Point(0, sender.Height - 50))
    Else
        ToolTip1.Active = False
    End If

End Sub

I really like this idea... Thanks!

Upvotes: 3

Hans Passant
Hans Passant

Reputation: 941665

The built-in ToolTip component creates a tooltip that looks pretty close. Set its IsBalloon property to True. Getting it exactly like Word is not practical, the component doesn't provide any way to override the TOOLINFO.uFlags value so you could specify TTF_CENTERTIP..

enter image description here

Upvotes: 7

Related Questions