TransformPattern.TransformPatternInformation.CanMove TransformPattern.TransformPatternInformation.CanMove TransformPattern.TransformPatternInformation.CanMove TransformPattern.TransformPatternInformation.CanMove Property

定義

UI オートメーションUI Automation 要素を移動できるかどうかを指定する値を取得します。Gets a value that specifies whether the UI オートメーションUI Automation element can be moved.

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

プロパティ値

要素を移動できる場合は true。それ以外の場合は falsetrue if the element can be moved; otherwise false.

次の例では、TransformPatternコントロール パターンがから取得した、AutomationElement後、移動に使用される、AutomationElementします。In the following example, a TransformPattern control pattern is obtained from an AutomationElement and subsequently used to move the 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.Move() method for an associated 
/// automation element.
/// </summary>
/// <param name="transformPattern">
/// The TransformPattern control pattern obtained from
/// an automation element.
/// </param>
/// <param name="x">
/// The number of screen pixels to move the automation element 
/// horizontally.
/// </param>
/// <param name="y">
/// The number of screen pixels to move the automation element 
/// vertically.
/// </param>
///--------------------------------------------------------------------
private void MoveElement(
    TransformPattern transformPattern, double x, double y)
{
    try
    {
        if (transformPattern.Current.CanMove)
        {
            transformPattern.Move(x, y);
        }
    }
    catch (InvalidOperationException)
    {
        // object is not able to perform the requested action
        return;
    }
}
'''--------------------------------------------------------------------
''' <summary>
''' Calls the TransformPattern.Move() method for an associated 
''' automation element.
''' </summary>
''' <param name="transformPattern">
''' The TransformPattern control pattern obtained from
''' an automation element.
''' </param>
''' <param name="x">
''' The number of screen pixels to move the automation element 
''' horizontally.
''' </param>
''' <param name="y">
''' The number of screen pixels to move the automation element 
''' vertically.
''' </param>
'''--------------------------------------------------------------------
Private Sub MoveElement( _
ByVal transformPattern As TransformPattern, _
ByVal x As Double, ByVal y As Double)
    Try
        If transformPattern.Current.CanMove Then
            transformPattern.Move(x, y)
        End If
    Catch exc As InvalidOperationException
        ' object is not able to perform the requested action
        Return
    End Try

End Sub 'MoveElement    

注釈

オブジェクトの移動、サイズ変更または回転後の画面位置はキーボードまたはマウスへのアクセスし、そのコンテナーの座標外完全になることはできません。An object cannot be moved, resized or rotated such that its resulting screen location would be completely outside the coordinates of its container and inaccessible to keyboard or mouse. たとえば、トップレベル ウィンドウが完全に画面外に移動したり、子オブジェクトは、コンテナーのビューポートの境界の外移動されます。For example, when a top-level window is moved completely off-screen or a child object is moved outside the boundaries of the container's viewport. このような場合、オブジェクトはコンテナーの境界内にオーバーライド上または左の座標で可能な要求された画面座標の近くに配置されます。In these cases the object is placed as close to the requested screen coordinates as possible with the top or left coordinates overridden to be within the container boundaries.

適用対象