Need Sample

Aug 15, 2007 at 7:15 PM
Really good effort,
Can you provide a sample on how to use the code, for example how to get Label1.Autosize value?



Regards


Coordinator
Aug 18, 2007 at 8:18 PM
The need that finally pushed me over the edge and made me put together this code was Accessibility. This is basically making your application work better for people with disabilities. If you look under Start/All Programs/Accessories/Accessibility you will see Narrator. For blind of vision impared people, this utility will read the screen for them.

The problem is that if you don't set things up correctly in your WinForms UI, it doesn't work very well. For example if you have a label in front of a textbox, Narrator should say the text of the label, the control type (textbox in this case) and the value in the textbox. This only works if the TabIndex of the label is less than the textboxes and greater than any other control that is visible and a TabStop.

Since there is little that depends on the TabIndex of labels, since they can't get focus, it is very easy to get them out of order with the control they should be in front of.

Wow, I went a little long on that one. In any case, that's what I plan on adding in a little bit. Thanks for your interest!
Aug 19, 2007 at 3:30 PM
Great Idea,
I tested the rule you sent, but no violations returned.
I created a VB application with two forms one of them is localized and added to both some controls labels, textboxes, buttons, panels...
When I ran the FxCop utility it doesn't return any violations.
I debugged the rule and found that the _component Dictionary contains only the Form properties, so each time you try to find a field TabStop property (using IsTabStop method) it can not find it.
Coordinator
Aug 19, 2007 at 5:01 PM
WOW! The InitializeComponent code that is generated in C# is completely different than for VB. This is what setting the Location looks like in VB:
Point VB$t_struct$S0 = new Point(0x85, 0x10);
this.TextBox1.Location = VB$t_struct$S0;
this.TextBox1.Name = "TextBox1";
This is what it looks like in C#:
this.textBox1.Location = new Point(0x85, 0x10);
this.textBox1.Name = "textBox1";

The first difference is that C# uses the field and VB uses a property to get to the field. The second is that VB uses a local variable to hold the values its creating (the Point in the above code). It then sets the control's property to that local variable.

Using the property is slightly more correct. The field has the AccessedThroughPropertyAttribute pointing it to the property.

In any case, I should be able to work this out. For the time being test against C# code.
Coordinator
Aug 19, 2007 at 5:02 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Aug 20, 2007 at 6:37 PM
Another Issue:

Missing Parent Value if the control Parent is TableLayoutPanel
Coordinator
Aug 21, 2007 at 10:43 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.