我有一個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