Share via


StylusDevice.Synchronize Yöntem

Tanım

İmleci ve kullanıcı arabirimini eşitler.

public:
 void Synchronize();
[System.Security.SecurityCritical]
public void Synchronize ();
public void Synchronize ();
[<System.Security.SecurityCritical>]
member this.Synchronize : unit -> unit
member this.Synchronize : unit -> unit
Public Sub Synchronize ()
Öznitelikler

Örnekler

Aşağıdaki örnekte, imlecin altındaki bir öğenin nasıl döndürüleceği gösterilmektedir. çağrısı Synchronize doğru öğeyi döndürdüğünden DirectlyOver emin olun.

void AnimateButton()
{
    TranslateTransform buttonTransform = new TranslateTransform(0, 0);
    button1.RenderTransform = buttonTransform;

    // Animate the Button's position.
    DoubleAnimation myDoubleAnimation = new DoubleAnimation();
    myDoubleAnimation.From = 0;
    myDoubleAnimation.By = 100;
    myDoubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(5));
    myDoubleAnimation.AutoReverse = true;
    myDoubleAnimation.RepeatBehavior = RepeatBehavior.Forever;

    buttonTransform.BeginAnimation(TranslateTransform.XProperty, myDoubleAnimation);       
}
Sub AnimateButton() 
    Dim buttonTransform As New TranslateTransform(0, 0)
    button1.RenderTransform = buttonTransform
    
    ' Animate the Button's position.
    Dim myDoubleAnimation As New DoubleAnimation()
    myDoubleAnimation.From = 0
    myDoubleAnimation.By = 100
    myDoubleAnimation.Duration = New Duration(TimeSpan.FromSeconds(5))
    myDoubleAnimation.AutoReverse = True
    myDoubleAnimation.RepeatBehavior = RepeatBehavior.Forever
    
    buttonTransform.BeginAnimation(TranslateTransform.XProperty, myDoubleAnimation)

End Sub
void SynchronizeCurrentStylus()
{
    StylusDevice currentStylus = Stylus.CurrentStylusDevice;

    currentStylus.Synchronize();
    UIElement element = (UIElement) currentStylus.DirectlyOver;
    output.Text += "The stylus is over " + element.ToString() + "\r\n";
}
Sub SynchronizeCurrentStylus()

    Dim currentStylus As StylusDevice = Stylus.CurrentStylusDevice

    currentStylus.Synchronize()
    Dim element As UIElement = CType(currentStylus.DirectlyOver, UIElement)
    output.Text += "The stylus is over " + element.ToString() + vbCr + vbLf

End Sub

Açıklamalar

Uygulamaların imlecin üzerine konumlandırılan öğeyi bulması gerekebilir. Uygulama animasyon kullanıyorsa, DirectlyOver yöntemi imlecin altından taşınan bir öğe döndürebilir. Uygun öğeyi döndürdüğünden DirectlyOver emin olmak için çağrısıSynchronize.

Şunlara uygulanır