|
Cet article a fait l'objet d'une traduction automatique. Déplacez votre pointeur sur les phrases de l'article pour voir la version originale de ce texte. Informations supplémentaires.
|
Traduction
Source
|
TextPattern.IsSubscriptAttribute, champ
Espace de noms : System.Windows.Automation
Assembly : UIAutomationClient (dans UIAutomationClient.dll)
Remarque |
|---|
private void GetIsSubscriptAttribute() { // Start application. Process p = Process.Start("Notepad.exe", "text.txt"); // target --> The root AutomationElement. AutomationElement target = AutomationElement.FromHandle(p.MainWindowHandle); // Specify the control type we're looking for, in this case 'Document' PropertyCondition cond = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Document); AutomationElement textProvider = target.FindFirst(TreeScope.Descendants, cond); TextPattern textpatternPattern = textProvider.GetCurrentPattern(TextPattern.Pattern) as TextPattern; if (textpatternPattern == null) { Console.WriteLine("Root element does not contain a descendant that supports TextPattern."); return; } Object oAttribute = textpatternPattern.DocumentRange.GetAttributeValue(TextPattern.IsSubscriptAttribute); if (oAttribute == TextPattern.MixedAttributeValue) { Console.WriteLine("Mixture of subscript and non-subscript."); } else { Console.WriteLine(oAttribute.ToString()); } }
Private Sub GetIsSubscriptAttribute() ' Start application. Dim p As Process = Process.Start("Notepad.exe", "text.txt") ' target --> The root AutomationElement. Dim target As AutomationElement = AutomationElement.FromHandle(p.MainWindowHandle) ' Specify the control type we're looking for, in this case 'Document' Dim cond As PropertyCondition = New PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Document) Dim textProvider As AutomationElement = target.FindFirst(TreeScope.Descendants, cond) Dim textpatternPattern As TextPattern = CType(textProvider.GetCurrentPattern(TextPattern.Pattern), TextPattern) If (textpatternPattern Is Nothing) Then Console.WriteLine("Root element does not contain a descendant that supports TextPattern.") Return End If Dim oAttribute As Object = textpatternPattern.DocumentRange.GetAttributeValue(TextPattern.IsSubscriptAttribute) If (oAttribute = TextPattern.MixedAttributeValue) Then Console.WriteLine("Mixture of subscript and non-subscript.") Else Console.WriteLine(oAttribute.ToString()) End If End Sub
- Confiance totale accordée à l'appelant immédiat. Ce membre ne peut pas être utilisé par du code d'un niveau de confiance partiel. Pour plus d'informations, consultez Utilisation de bibliothèques à partir de code d'un niveau de confiance partiel.
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (rôle principal du serveur non pris en charge), Windows Server 2008 R2 (rôle principal du serveur pris en charge avec SP1 ou version ultérieure ; Itanium non pris en charge)
Le .NET Framework ne prend pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.
Remarque