为什么我的文字一直突出显示? [英] Why does my text keep highlighting?

查看:149
本文介绍了为什么我的文字一直突出显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在vb.net中做一个吐司",每当它弹出时,正文文本框中的所有文本总是被突出显示...如何以编程方式删除该突出显示?

I am making a "toast" in vb.net, and whenever it pops up, all the text in the body textbox is ALWAYS highlighted...how can I remove the highlight programmatically?

谢谢!

以下代码似乎会自动突出显示:

Here is the code which seems to be automatically highlighting:

Dim i As Integer
        toast.HeaderL.Text = headertext
        toast.BodyL.Text = contenttext
        toast.Show()
        toast.Opacity = 0
        i = 0
        While i < 100
            toast.SetDesktopLocation(My.Computer.Screen.WorkingArea.Right - toast.Width, My.Computer.Screen.WorkingArea.Bottom - ((toast.Height / 100) * i))
            toast.Opacity += 0.01
            wait(7)
            i += 1
        End While
        wait(4000)
        toast.Opacity = 1
        i = 0
        While i < 100
            toast.SetDesktopLocation(toast.Location.X, toast.Location.Y + toast.Height / 100)
            toast.Opacity -= 0.01
            wait(7)
            i += 1
        End While
        toast.Close()

BodyL(这是一个文本框)中的文本始终会突出显示.我曾尝试在某些地方添加toast.Focus(),但这没用.

Always, the text inside BodyL (which is a textbox), highlights itself.I tried adding in toast.Focus() at some points, but that did not work.

toast是表单名称.

toast is the form name.

推荐答案

更多的是猜测,但是在将文本分配给BodyL之后,您可以尝试添加以下行:

It's more of a guess, but you could try to add the following line, after assigning the text to BodyL:

toast.BodyL.Select(toast.BodyL.Text.Length, 0)

另一个想法是向烤面包机窗体中添加一些其他控件(例如Panel),该控件可以接收输入焦点而不会显示(可以变得非常小,甚至可以将其移到窗体的可见部分之外) ),并确保在显示吐司形式时该控件获得焦点.

Another idea is to add some other control to the toast form (such as a Panel) that can receive input focus without showing (it can be made very tiny, or even have it moved outside the visible part of the form), and making sure that that control receives focus when the toast form is displayed.

这篇关于为什么我的文字一直突出显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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