InertiaRotationBehavior 類別

定義

控制旋轉操作在慣性期間的減速。Controls the deceleration of a rotation manipulation during inertia.

public ref class InertiaRotationBehavior
public class InertiaRotationBehavior
type InertiaRotationBehavior = class
Public Class InertiaRotationBehavior
繼承
InertiaRotationBehavior

範例

下列範例會顯示ManipulationInertiaStarting事件處理常式, 並設定慣性期間所使用之轉譯、擴充和旋轉所需的減速。The following example shows the ManipulationInertiaStarting event handler and sets the desired deceleration for translation, expansion, and rotation that is used during inertia. 這個範例是逐步解說中較大範例的一部分:建立您的第一個觸控應用程式。This example is part of a larger example in Walkthrough: Creating Your First Touch Application.

void Window_InertiaStarting(object sender, ManipulationInertiaStartingEventArgs e)
{

    // Decrease the velocity of the Rectangle's movement by 
    // 10 inches per second every second.
    // (10 inches * 96 pixels per inch / 1000ms^2)
    e.TranslationBehavior.DesiredDeceleration = 10.0 * 96.0 / (1000.0 * 1000.0);

    // Decrease the velocity of the Rectangle's resizing by 
    // 0.1 inches per second every second.
    // (0.1 inches * 96 pixels per inch / (1000ms^2)
    e.ExpansionBehavior.DesiredDeceleration = 0.1 * 96 / (1000.0 * 1000.0);

    // Decrease the velocity of the Rectangle's rotation rate by 
    // 2 rotations per second every second.
    // (2 * 360 degrees / (1000ms^2)
    e.RotationBehavior.DesiredDeceleration = 720 / (1000.0 * 1000.0);

    e.Handled = true;
}
Private Sub Window_InertiaStarting(ByVal sender As Object,
                                   ByVal e As ManipulationInertiaStartingEventArgs)

    ' Decrease the velocity of the Rectangle's movement by 
    ' 10 inches per second every second.
    ' (10 inches * 96 pixels per inch / 1000ms^2)
    e.TranslationBehavior.DesiredDeceleration = 10.0 * 96.0 / (1000.0 * 1000.0)

    ' Decrease the velocity of the Rectangle's resizing by 
    ' 0.1 inches per second every second.
    ' (0.1 inches * 96 pixels per inch / (1000ms^2)
    e.ExpansionBehavior.DesiredDeceleration = 0.1 * 96 / (1000.0 * 1000.0)

    ' Decrease the velocity of the Rectangle's rotation rate by 
    ' 2 rotations per second every second.
    ' (2 * 360 degrees / (1000ms^2)
    e.RotationBehavior.DesiredDeceleration = 720 / (1000.0 * 1000.0)

    e.Handled = True
End Sub

備註

InertiaRotationBehavior類別會指定旋轉操作在慣性時的行為方式。The InertiaRotationBehavior class specifies how a rotation manipulation behaves when it is inertia. 請使用ManipulationInertiaStarting事件中的屬性來執行下列動作:RotationBehaviorUse the RotationBehavior property in the ManipulationInertiaStarting event to do the following:

  • 從設定InitialVelocity屬性開始, 指定慣性的初始速度。Specify the initial velocity of the inertia when it begins by setting the InitialVelocity property.

  • 藉由設定DesiredRotation屬性來指定慣性結束時所需的操作旋轉。Specify the desired rotation of the manipulation when inertia ends by setting the DesiredRotation property.

  • 藉由設定DesiredDeceleration屬性, 指定所需的慣性減速。Specify the desired deceleration of the inertia by setting the DesiredDeceleration property.

DesiredRotation 設定DesiredDeceleration或, 但不是兩者。Set either the DesiredRotation or the DesiredDeceleration, but not both. 當您設定其中一個屬性時, 如果它有值, 另Double.NaN一個屬性會變更為。When you set one of these properties, the other property is changed to Double.NaN if it has a value.

如需操作的詳細資訊, 請參閱輸入總覽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.

建構函式

InertiaRotationBehavior()

初始化 InertiaRotationBehavior 類別的新執行個體。Initializes a new instance of the InertiaRotationBehavior class.

屬性

DesiredDeceleration

取得或設定旋轉變慢的速率 (以每平方毫秒的度數為單位)。Gets or sets the rate the rotation slows in degrees per squared millisecond.

DesiredRotation

取得或設定慣性移動結束時的旋轉 (以度數為單位)。Gets or sets the rotation, in degrees, at the end of the inertial movement.

InitialVelocity

取得或設定旋轉在慣性階段開始時的初始速率。Gets or sets the initial rate of the rotation at the start of the inertia phase.

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetHashCode()

作為預設雜湊函數。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

適用於