【发布时间】:2010-11-03 16:19:03
【问题描述】:
我有一个 WinForms 应用程序,但我似乎无法通过 UIAutomation 访问 ToolStripStatusLabel 的文本。 Microsoft implies 表示对 StatusStrips(以及其中的项目)的支持是有限的,但这似乎是一个足够基本的用例,它应该可以工作。
该控件在 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 以某种方式获得该价值。
【问题讨论】:
标签: .net windows winforms accessibility ui-automation