为什么气球尖端的位置和杆的方向有问题? [英] Why are balloon tip position and stem orientation buggy?

查看:117
本文介绍了为什么气球尖端的位置和杆的方向有问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在文本框中使用气球提示来指示非数字输入(实时).输入第二个非数字字符后,气球尖端的位置和杆的方向会发生变化(反转且不希望出现

I'm using a balloon tip on a text box to indicate non-numeric entry (real-time). Once a second non-numeric character is inputted, the balloon tip position and stem orientation changes (inverts and undesirably

  1. 在Visual Studio的设计模式下,将文本框和工具提示拖到新表单上.
  2. 按原样使用以下内容:

代码:

Public Class Form1
    Private Sub Textbox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        If (Not IsNumeric(TextBox1.Text) And TextBox1.Text.Length > 0) Then
            ToolTip1.ToolTipTitle = "Input must be numeric!"
            ToolTip1.Active = True
            ToolTip1.IsBalloon = True
            ToolTip1.Show(vbNewLine, TextBox1, 45, -40)
        Else
            ToolTip1.Active = False
            ToolTip1.Hide(TextBox1)
        End If
    End Sub
End Class

推荐答案

您可以在显示> 可见之前对其进行检查:

You can check if tooltip is visible before showing it:

Private Sub TextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox1.TextChanged
    If (Not IsNumeric(TextBox1.Text) And TextBox1.Text.Length > 0) Then
        If ToolTip1.GetToolTip(TextBox1) = "" Then
            ToolTip1.ToolTipTitle = "Input must be numeric!"
            ToolTip1.Active = True
            ToolTip1.IsBalloon = True
            ToolTip1.Show(vbNewLine, TextBox1, 45, -40)
        End If
    Else
        ToolTip1.Active = False
        ToolTip1.Hide(TextBox1)
    End If
End Sub

这篇关于为什么气球尖端的位置和杆的方向有问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆