|
Este artículo proviene de un motor de traducción automática. Mueva el puntero sobre las frases del artículo para ver el texto original. Más información.
|
Traducción
Original
|
TextPattern.IsReadOnlyAttribute (Campo)
Espacio de nombres: System.Windows.Automation
Ensamblado: UIAutomationClient (en UIAutomationClient.dll)
Nota |
|---|
Nota |
|---|
private void GetIsReadOnlyAttribute() { // 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.IsReadOnlyAttribute); if (oAttribute == TextPattern.MixedAttributeValue) { Console.WriteLine("Mixture of readonly and non-readonly."); } else { Console.WriteLine(oAttribute.ToString()); } }
Private Sub GetIsReadOnlyAttribute() ' 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.IsReadOnlyAttribute) If (oAttribute = TextPattern.MixedAttributeValue) Then Console.WriteLine("Mixture of readonly and non-readonly.") Else Console.WriteLine(oAttribute.ToString()) End If End Sub
- Plena confianza para el llamador inmediato. Un código de confianza parcial no puede utilizar este miembro. Para obtener más información, vea Utilizar bibliotecas de código que no es de plena confianza.
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (no se admite el rol Server Core), Windows Server 2008 R2 (se admite el rol Server Core con SP1 o versiones posteriores; no se admite Itanium)
.NET Framework no admite todas las versiones de todas las plataformas. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.
Nota