2016-11-29 103 views

回答

0

您可以訂閱PointerPressed上InkCanvas事件。它有參數PointerRoutedEventArgs和。過濾您的輸入設備和單獨的按鈕是這樣的:

if (e.Pointer.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Pen) 
{ 
    var point = e.GetCurrentPoint(YourCanvasName); 
    if (point.Properties.IsLeftButtonPressed) 
    { 
     //Button1 
    } 
    if (point.Properties.IsMiddleButtonPressed) 
    { 
     //Button2 
    } 
    if (point.Properties.IsRightButtonPressed) 
    { 
     //Button3 
    } 
} 

應該工作,雖然我沒有筆測試:)

+0

我都試過'inkCanvas.PointerPressed'和'InkCanvas.InkPresenter。 UnprocessedInput.PointerPressed'bot都不會觸發它們,既不是當我按下按鈕時,也不是當筆按下按鈕時觸摸畫布。 – Liero