WPF Image Touch Move method

Source: Internet
Author: User

   1:  null;
   2:  double moffsetx;  Horizontal scroll bar Current position
   3:  double moffsety;  Vertical scroll bar Current position
   4:  boolfalse;  Whether to touch
   5:  //Touch Event
   6:  privatevoid mscrollviewer_touchdown (object sender, TouchEventArgs e)
   7:  {
   8:      true;  is touching
   9:  this    . Mscrollviewer.horizontaloffset;  Get ScrollViewer scroll bar current position
  Ten:  this    . Mscrollviewer.verticaloffset;  Get ScrollViewer scroll bar current position
One   :      mpoint = E.gettouchpoint (mscrollviewer);  Get the touch point position relative to ScrollViewer
  :  }
  :  
  :  //Touch Move Event
  :  privatevoid mscrollviewer_touchmove (object sender, TouchEventArgs e)
  :  {
If true) //If you are touching      
  :      {
  :          TouchPoint point = E.gettouchpoint (mscrollviewer);  Get the touch point position relative to ScrollViewer
  :          double diffoffsetx = point. position.x-mpoint.position.x; //Calculate relative position
  :          double diffoffsety = point. POSITION.Y-MPOINT.POSITION.Y; //Calculate relative position
  :  this        . Mscrollviewer.scrolltohorizontaloffset (MOFFSETX-DIFFOFFSETX);  ScrollViewer Scroll to the specified position
At   :  this        . Mscrollviewer.scrolltoverticaloffset (moffsety-diffoffsety);  ScrollViewer Scroll to the specified position
  :      }
  :  }
  £ º  
  :  //Touch End Event
  :  privatevoid mscrollviewer_touchup (object sender, TouchEventArgs E )
  :  {
  :      false;  Touch End
  :  }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.