Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 491891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T02:03:25+00:00 2026-05-13T02:03:25+00:00

I’m trying to get you into the picture firstly, I’m trying to implement a

  • 0

I’m trying to get you into the picture firstly, I’m trying to implement a gesture in WPF4 VS2010, it is like you move your finger until it crosses a TouchPoint that you already passed by with the SAME finger , so my thought is to make a list and check for every new TouchPoint if it exists , if yes then you have done your gesture , if not then add the TouchPoint to the collection to be compared with the following TouchPoints. for some reason this doesn’t work well so I moved to another approach , replacing TouchPoints with X , Y for the TouchPoint and convert them into Strings and try to use Contains method against them , using TouchMove and TouchUp events my code looks like :

 private void g1_TouchMove(object sender, TouchEventArgs e)
    {



       if(touchX.Contains(""+e.GetTouchPoint(g1).Position.X) && touchY.Contains(""+e.GetTouchPoint(g1).Position.Y))
        {
         // Clearing the lists , changing the canvas background color to know that the gesture is done
           touchX.Clear();
           touchY.Clear();
           g1.Background = Brushes.AliceBlue;

        }
       else
       {
           //adding new X, Y values to their respective lists
           touchX.Add(""+e.GetTouchPoint(g1).Position.X);
           touchY.Add( ""+e.GetTouchPoint(g1).Position.Y);


       }

    }
private void g1_TouchUp(object sender, TouchEventArgs e)
    {
        //clearing the lists after the touch is up (finger removed)
        touchX.Clear();
        touchY.Clear();
        //getting the canvas it's original background color
        g1.Background = Brushes.Orange;

    }

So , when testing it it doesn’t work , even if I move my touch in a straight line it changes the background. any Ideas ?

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T02:03:26+00:00Added an answer on May 13, 2026 at 2:03 am

    First off, go back to using numbers. Putting numbers into strings for later comparison is wrong on so many levels 🙂

    My guess is that your problem is a resolution problem – It’s practically impossible to hit the exact same spot as before, since there are a lot of pixels on the screen. Basically, one pixel off will render your algorithm useless. You should instead map your touch area into a few larger clusters and check if the touch has been in this cluster before (as opposed to the exact same pixel).

    A simple approach is to just integer division on the coordinates you receive.

    In the example below, I divide the pixel coordinate system with clusters of 3 by 3 pixels but you could go with larger if that makes sense for you. It all depends on how big the resolution of the touch area is.

    What this means in practice is that any pixel within this 3 by 3 area is considered equal. So a hit on (1,1) is matching a previous hit on (2,3) and so on.

    // Divide into 3x3 pixel clusters
    var currentCluster = new Point((int)touchPos.X / 3, (int)touchPos.Y / 3)
    // previousClusters is a List<Point>() which is cleared on TouchUp
    foreach (var cluster in previousClusters)
    {
        if (cluster == currentCluster)
        {
            // We've been here before, do your magic here!
            g1.Background = Brushes.AliceBlue;
            // Return here, since we don't want to add the point again
            return;
        }
    }
    previousClusters.Add(currentCluster);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.