Share via


TransformPattern.TransformPatternInformation.CanResize Propiedad

Definición

Obtiene un valor que especifica si se puede cambiar el tamaño del elemento Automatización de la interfaz de usuario.

public:
 property bool CanResize { bool get(); };
public bool CanResize { get; }
member this.CanResize : bool
Public ReadOnly Property CanResize As Boolean

Valor de propiedad

Boolean

true si se puede cambiar el tamaño del elemento; en caso contrario, false.

Ejemplos

En el ejemplo siguiente, se obtiene un TransformPattern patrón de control de AutomationElement y, posteriormente, se usa para cambiar el tamaño de AutomationElement.

///--------------------------------------------------------------------
/// <summary>
/// Obtains a TransformPattern control pattern from 
/// an automation element.
/// </summary>
/// <param name="targetControl">
/// The automation element of interest.
/// </param>
/// <returns>
/// A TransformPattern object.
/// </returns>
///--------------------------------------------------------------------
private TransformPattern GetTransformPattern(
    AutomationElement targetControl)
{
    TransformPattern transformPattern = null;

    try
    {
        transformPattern =
            targetControl.GetCurrentPattern(TransformPattern.Pattern)
            as TransformPattern;
    }
    catch (InvalidOperationException)
    {
        // object doesn't support the TransformPattern control pattern
        return null;
    }

    return transformPattern;
}
'''--------------------------------------------------------------------
''' <summary>
''' Obtains a TransformPattern control pattern from 
''' an automation element.
''' </summary>
''' <param name="targetControl">
''' The automation element of interest.
''' </param>
''' <returns>
''' A TransformPattern object.
''' </returns>
'''--------------------------------------------------------------------
Private Function GetTransformPattern( _
ByVal targetControl As AutomationElement) As TransformPattern
    Dim transformPattern As TransformPattern = Nothing

    Try
        transformPattern = DirectCast( _
        targetControl.GetCurrentPattern(transformPattern.Pattern), _
        TransformPattern)
    Catch exc As InvalidOperationException
        ' object doesn't support the TransformPattern control pattern
        Return Nothing
    End Try

    Return transformPattern

End Function 'GetTransformPattern
///--------------------------------------------------------------------
/// <summary>
/// Calls the TransformPattern.Resize() method for an associated 
/// automation element.
/// </summary>
/// <param name="transformPattern">
/// The TransformPattern control pattern obtained from
/// an automation element.
/// </param>
/// <param name="width">
/// The requested width of the automation element.
/// </param>
/// <param name="height">
/// The requested height of the automation element.
/// </param>
///--------------------------------------------------------------------
private void ResizeElement(
    TransformPattern transformPattern, double width, double height)
{
    try
    {
        if (transformPattern.Current.CanResize)
        {
            transformPattern.Resize(width, height);
        }
    }
    catch (InvalidOperationException)
    {
        // object is not able to perform the requested action
        return;
    }
}
'''--------------------------------------------------------------------
''' <summary>
''' Calls the TransformPattern.Resize() method for an associated 
''' automation element.
''' </summary>
''' <param name="transformPattern">
''' The TransformPattern control pattern obtained from
''' an automation element.
''' </param>
''' <param name="width">
''' The requested width of the automation element.
''' </param>
''' <param name="height">
''' The requested height of the automation element.
''' </param>
'''--------------------------------------------------------------------
Private Sub ResizeElement( _
ByVal transformPattern As TransformPattern, _
ByVal width As Double, ByVal height As Double)
    Try
        If transformPattern.Current.CanResize Then
            transformPattern.Resize(width, height)
        End If
    Catch
        ' object is not able to perform the requested action
        Return
    End Try

End Sub

Comentarios

No se puede mover, cambiar el tamaño o girar un objeto de modo que su ubicación de pantalla resultante estaría completamente fuera de las coordenadas de su contenedor y no se puede acceder al teclado o al mouse. Por ejemplo, cuando una ventana de nivel superior se mueve completamente fuera de la pantalla o un objeto secundario se mueve fuera de los límites de la ventanilla del contenedor. En estos casos, el objeto se coloca lo más cerca posible de las coordenadas de pantalla solicitadas con las coordenadas superior o izquierda invalidada para estar dentro de los límites del contenedor.

Se aplica a