我有一个WinForms应用程序,我似乎无法通过UIAutomation访问ToolStripStatusLabel
的文本。微软implies支持StatusStrip
s(以及其中的项目)是有限的,但这似乎是一个基本的足够用例,它应该工作。UIAutomation与ToolStripStatusLabel
该控件在UISpy中显示为ControlType.Edit
,似乎只是只读文本框,但其值始终与其名称相同,而不是其文本。是
在UISpy的属性如下:
AutomationElement
General Accessibility
AccessKey: ""
AcceleratorKey: ""
IsKeyboardFocusable: "False"
LabeledBy: "(null)"
HelpText: ""
State
IsEnabled: "True"
HasKeyboardFocus: "False"
Identification
ClassName: ""
ControlType: "ControlType.Edit"
Culture: "(null)"
AutomationId: "StatusBar.Pane0"
LocalizedControlType: "edit"
Name: "My Label"
ProcessId: "3972 (*****)"
RuntimeId: "42 134002 0"
IsPassword: "False"
IsControlElement: "True"
IsContentElement: "True"
Visibility
BoundingRectangle: "(9, 273, 79, 17)"
ClickablePoint: "48,281"
IsOffscreen: "False"
ControlPatterns
GridItem
Row: "0"
Column: "0"
RowSpan: "1"
ColumnSpan: "1"
ContainingGrid: ""status bar" "statusStrip""
Value
Value: "My Label"
IsReadOnly: "True"
基本上,我希望一段路要走myLabel.Text = "something"
并能够通过UIAutomation获得该值出莫名其妙。
啊,有意思。我会在下周尝试这个!任何想法为什么它可能会被暴露为编辑控制?这对我来说很好,但它似乎会误导屏幕阅读器。 – Thom 2009-08-29 11:29:09