Stylus.SetIsPressAndHoldEnabled(DependencyObject, Boolean) 方法

定義

設定所指定元素上的 IsPressAndHoldEnabled 附加屬性值。

public:
 static void SetIsPressAndHoldEnabled(System::Windows::DependencyObject ^ element, bool enabled);
public static void SetIsPressAndHoldEnabled (System.Windows.DependencyObject element, bool enabled);
static member SetIsPressAndHoldEnabled : System.Windows.DependencyObject * bool -> unit
Public Shared Sub SetIsPressAndHoldEnabled (element As DependencyObject, enabled As Boolean)

參數

element
DependencyObject

要在其上啟用按住不放的 UIElementContentElement

enabled
Boolean

true 表示啟用按住不放,false 表示停用按住不放。

範例

下列範例示範如何啟用 按住 。Slider 這個範例假設有名為 SliderhorizontalSlider1的 。

if (!Stylus.GetIsPressAndHoldEnabled(horizontalSlider1))
{
    Stylus.SetIsPressAndHoldEnabled(horizontalSlider1, true);
}
If Not Stylus.GetIsPressAndHoldEnabled(horizontalSlider1) Then
    Stylus.SetIsPressAndHoldEnabled(horizontalSlider1, True)
End If

備註

按住對應至滑鼠右鍵。 在 Windows Vista 中,如果您預期使用者在不想要模擬滑鼠右鍵的情況下,可能會按住平板電腦畫筆,則可以在元素上停用此行為。

適用於