Вопрос

I'm developing an application for the Sur40 with PixelSense2.0. I'm trying to capture the touch input but it keeps providing me the same error: No overload for method 'GetTouchPoint' takes 0 arguments.

This is my code so far:

    void SurfaceWindow1_Loaded(object sender, RoutedEventArgs e)
    {


        this.TouchDown += new EventHandler<TouchEventArgs>(SurfaceWindow1_TouchDown);

    }

    void SurfaceWindow1_TouchDown(object sender, TouchEventArgs e)
    {
        LoadAnimationControl2 ani1 = new LoadAnimationControl2();
        ani1.Margin.Left = e.GetTouchPoint().Position.X;
        ani1.Margin.Bottom = e.GetTouchPoint().Position.Y;
        MainGrid.Children.Add(ani1);
    }

Does anybody have a suggestion how to deal with this problem?

Это было полезно?

Решение 3

void SurfaceWindow1_TouchDown(object sender, TouchEventArgs e)
{
    LoadAnimationControl2 ani1 = new LoadAnimationControl2();
    ani1.Margin.Left = e.GetTouchPoint(this).Position.X;
    ani1.Margin.Bottom = e.GetTouchPoint(this).Position.Y;
    MainGrid.Children.Add(ani1);
}

Другие советы

GetTouchPoint() has a required input parameter. There is no method signature that doesn't use a parameter. You need to pass in an IInputElement as a parameter to the method.

GetTouchPoint() MSDN Reference page

Well according to the docs:

public TouchPoint GetTouchPoint(
    IInputElement relativeTo
)

It takes an IInputElement which is: The element that defines the coordinate space.
and it returns: The current position of the touch device relative to the specified element.

So what you need to do is pass in your "screen" or whatever the correct terminology is to get what is being viewed.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top