pub struct UiAutomationTextPattern(/* private fields */);Expand description
提供对包含文本的控件的访问。
Implementations§
source§impl UiAutomationTextPattern
impl UiAutomationTextPattern
sourcepub fn document_range(&self) -> UiAutomationTextRange
pub fn document_range(&self) -> UiAutomationTextRange
查询包含文档正文的文本范围。 此属性是只读的。 某些辅助文本(如页眉、脚注或批注)可能不包括在内。
sourcepub fn get_selection(&self) -> Vec<UiAutomationTextRange>
pub fn get_selection(&self) -> Vec<UiAutomationTextRange>
查询文本范围的集合,该集合表示基于文本的控件中当前选定的文本。 如果控件支持选择多个不连续的文本范围,则 ranges 集合将为每个选定的范围接收一个文本范围。 如果控件仅包含所选文本的单个范围,则 ranges 集合将接收单个文本范围。 如果控件包含文本插入点,但未选择任何文本,则 ranges 集合将在文本插入点的位置接收一个退化(空)文本区域。 如果控件不包含文本插入点或不支持文本选择,则范围设置为 NULL。 使用 supported_text_selection 属性测试控件是否支持文本选择。
sourcepub fn supported_text_selection(&self) -> SupportedTextSelection
pub fn supported_text_selection(&self) -> SupportedTextSelection
查询一个值,该值指定控件支持的文本选择的类型。 此属性是只读的。
sourcepub fn get_visible_ranges(&self) -> Vec<UiAutomationTextRange>
pub fn get_visible_ranges(&self) -> Vec<UiAutomationTextRange>
从基于文本的控件中检索不相交的文本范围的数组,其中每个文本区域表示可见文本的连续范围。
sourcepub fn range_from_child(
&self,
child: &UiAutomationElement,
) -> Option<UiAutomationTextRange>
pub fn range_from_child( &self, child: &UiAutomationElement, ) -> Option<UiAutomationTextRange>
查询包含子元素(如图像、超链接、Microsoft Excel 电子表格或其他嵌入对象)的文本区域。
如果区域中没有包含子元素的文本,则返回退化(空)区域。
child 要包含在文本范围中的子元素,可以是与 UiAutomationTextPattern 关联的元素的子参数,也可以是 UiAutomationTextRange 的子元素数组的子参数。
sourcepub fn range_from_point(&self, x: i32, y: i32) -> Option<UiAutomationTextRange>
pub fn range_from_point(&self, x: i32, y: i32) -> Option<UiAutomationTextRange>
查询最接近指定屏幕坐标的退化(空)文本范围。 如果屏幕坐标位于图像、超链接、Microsoft Excel 电子表格或其他嵌入对象的坐标内,则返回换行子对象的文本区域。 由于不会忽略隐藏文本,因此此方法从最接近指定坐标的可见文本中检索退化范围。 Windows Internet Explorer 9 中 range_from_point 的实现不会返回预期的结果。相反,客户应该:
- 调用get_visible_ranges方法以检索可见文本范围的数组。
- 对于数组中的每个文本范围,调用get_bounding_rectangles以检索边界矩形。
- 检查边界矩形以查找占据特定屏幕坐标的文本范围。