ManipulationStartingEventArgs.Pivot 屬性

定義

取得或設定物件,這個物件描述單點操作的樞紐。Gets or sets an object that describes the pivot for a single-point manipulation.

public:
 property System::Windows::Input::ManipulationPivot ^ Pivot { System::Windows::Input::ManipulationPivot ^ get(); void set(System::Windows::Input::ManipulationPivot ^ value); };
public System.Windows.Input.ManipulationPivot Pivot { get; set; }
member this.Pivot : System.Windows.Input.ManipulationPivot with get, set
Public Property Pivot As ManipulationPivot

屬性值

ManipulationPivot

物件,描述單點操作的樞紐。An object that describes the pivot for a single-point manipulation.

範例

下列範例顯示事件的事件處理常式 ManipulationStarting ,並設定 ManipulationStartingEventArgs.Pivot 屬性。The following example shows an event handler for the ManipulationStarting event and sets the ManipulationStartingEventArgs.Pivot property. 若要測試此範例,請遵循逐步解說 :建立您的第一個觸控應用程式 中的步驟,並將步驟4中的程式碼取代為此程式碼。To test this example, follow the steps in Walkthrough: Creating Your First Touch Application and replace the code in step 4 with this code.

void Window_ManipulationStarting(object sender, ManipulationStartingEventArgs e)
{
    // Set the ManipulationPivot so that the element rotates as it is
    // moved with one finger.
    FrameworkElement element = e.OriginalSource as FrameworkElement;
    ManipulationPivot pivot = new ManipulationPivot();
    pivot.Center = new Point(element.ActualWidth / 2, element.ActualHeight / 2);
    pivot.Radius = 20;
    e.Pivot = pivot;

    e.ManipulationContainer = this;
    e.Handled = true;
}
Private Sub Window_ManipulationStarting(ByVal sender As Object, ByVal e As ManipulationStartingEventArgs)
    ' Set the ManipulationPivot so that the element rotates as it is
    ' moved with one finger.
    Dim element As FrameworkElement = TryCast(e.OriginalSource, FrameworkElement)
    Dim pivot As New ManipulationPivot()
    pivot.Center = New Point(element.ActualWidth / 2, element.ActualHeight / 2)
    pivot.Radius = 20
    e.Pivot = pivot

    e.ManipulationContainer = Me
    e.Handled = True
End Sub

備註

當您設定 Pivot 屬性時,當使用者在操作期間使用一個手指時,操作會包含旋轉資料。When you set the Pivot property, the manipulation will contain rotation data when the user uses one finger during a manipulation. 這是為了模擬真實世界的狀況,您可以使用一個手指來旋轉物件,例如資料表上的一片紙。This is to simulate real-world situations where you can use one finger to rotate an object, such as a piece of paper on a table. 如果 Pivotnull ,則使用者必須使用雙手指來引發旋轉。If the Pivot is null, the user must use two fingers to cause rotation.

如需操作的詳細資訊,請參閱 輸入總覽For more information about manipulations, see the Input Overview. 如需回應操作的應用程式範例,請參閱 逐步解說:建立您的第一個觸控應用程式For an example of an application that responds to manipulations, see Walkthrough: Creating Your First Touch Application.

適用於