简体   繁体   English

Windows窗体中的TextBox中的辅助功能-Visual Studio

[英]Accessibility in TextBox in Windows Form - Visual Studio

I'm new to visual studio and I'm developing an application for visually impaired. 我是Visual Studio的新手,正在为视障人士开发应用程序。 I'm testing my application with NVDA. 我正在用NVDA测试我的应用程序。 The audio feedback I'm getting on moving focus to a TextBox using tab button is just "Edit-Blank". 我正在使用标签按钮将焦点移到TextBox上的音频反馈只是“ Edit-Blank”。 I want to change that to a custom text. 我想将其更改为自定义文本。 How can I do that? 我怎样才能做到这一点?

That has nothing to do with accessibility, actually. 实际上,这与可访问性无关。 When developing for accessibility, please always keep in mind the following: a blind (deaf, ...) user must get the same info as all of your users, starting from yourself, unless you absolutely need to convey something that is inaccessible otherwise (a visual tooltip instead of a sound for deaf users, an alternative text description of an image for blind users, etc.). 在开发可访问性时,请始终牢记以下几点:盲人(聋人,...)用户必须从您自己那里获得与所有用户相同的信息,除非您绝对需要传达其他无法访问的信息(视觉工具提示,而不是聋人的声音,盲人用户的图像替代文字说明,等等)。
Here NVDA tells you what you actually get: the edit box is blank, indeed. NVDA在这里告诉您您实际上得到了什么:编辑框实际上是空白的。 If you want to describe the box, you need a label , not something in the text box (let the user enter his/her text in it). 如果你想描述中,您需要一个标签 ,不是文本框中(让用户在其中输入他/她的文字)。 So: 所以:

private Label myLabel;
// ...
this.myLabel = new Label();
// ...
this.myLabel.Text = "Your Name:";

and place that label to the left (or above) the edit box. 并将该标签放在编辑框的左侧(或上方)。 You may also set AccessibleRole , if you want: 如果需要,还可以设置AccessibleRole

this.myLabel.AccessibleRole = AccessibleRole.StaticText;

I suggest to do this if your form is actually a dialog box. 如果您的表单实际上是一个对话框,我建议您这样做。

You need to put a Label control into the form and update the TabIndex properties of the Label and TextBox, so that the Label's TabIndex value is one less than the TextBox's TabIndex value (eg label1.TabIndex == 1 and textBox1.TabIndex == 2). 您需要将Label控件放入窗体中,并更新Label和TextBox的TabIndex属性,以使Label的TabIndex值比TextBox的TabIndex值小一个(例如,label1.TabIndex == 1和textBox1.TabIndex == 2 )。
Then, the Text of the Label will be read when entering the TextBox. 然后,在输入文本框时将读取标签的文本。

To make a TextBox more accessible by NVDA you can perform either of the following settings: 要使NVDA更易于访问TextBox ,可以执行以下任一设置:

  • You can set AccessibleName 您可以设置AccessibleName
  • You can set AccessibleDescription 您可以设置AccessibleDescription
  • You can put a Label control near the TextBox having immediate TabIndex before the TextBox . 你可以把一个Label不远控制TextBox有着直接TabIndex的前TextBox

For Narrator you can perform either of the following settings: 对于讲述人,您可以执行以下任一设置:

  • You can set AccessibleName 您可以设置AccessibleName
  • You can set Cue Banner for the TextBox . 您可以为TextBox设置提示横幅
  • You can put a Label control near the TextBox having immediate TabIndex before the TextBox . 你可以把一个Label不远控制TextBox有着直接TabIndex的前TextBox

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM