为什么在文本高亮显示文本(选择)显示表单时? [英] Why is text in textbox highlighted (selected) when form is displayed?

查看:106
本文介绍了为什么在文本高亮显示文本(选择)显示表单时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含在C#中的文本框,我设置为一个字符串如下形式:

I have a form containing a textbox in C# which I set to a string as follows:

textBox.Text = str;

当窗体显示,为什么在texbox文本突出显示/选择?

When the form is displayed, why does the text in the texbox appear highlighted/selected?

推荐答案

文本框有一个的TabIndex 0和接受tab 设置为true。这意味着,显示表单时控制将给予重点。

The text box has a TabIndex of 0 and TabStop set to true. This means that the control will be given focus when the form is displayed.

您既可以给另一个控制0 的TabIndex (如果有),给文本框中输入不同的选项卡索引(> 0),或者设置接受tab 为false,文本框来阻止这种情况发生。

You can either give another control the 0 TabIndex (if there is one) and give the text box a different tab index (>0), or set TabStop to false for the text box to stop this from happening.

这篇关于为什么在文本高亮显示文本(选择)显示表单时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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