none
About Unacessable informtion(Width and Height) on the Touch in WPF environment. RRS feed

  • Question

  • Hi.

    The Width and Height information is always 0. but In win32 Application, It can be readable.

    From the handler I can read the masking state and the above information from the TOUCHINPUT structure like below code.

    void TouchHandler(HWND hwnd, const TOUCHINPUT& ti)

    {

      if (ti.dwMask == TOUCHINPUTMASKF_CONTACTAREA)

      {

         ti.cxContact; // width

         ti.cyContact; // height

      }

    }

    but, I could not read the width, height information from the touches on the WPF.

        private void Canvas_TouchDown(object sender, TouchEventArgs e)
        {
            canvMain.CaptureTouch(e.TouchDevice);

            TouchPoint tp = e.GetTouchPoint(canvMain);

            Ellipse el = new Ellipse();
            el.Stroke = Brushes.Black;
            el.Fill = Brushes.Black;

            el.Width = tp.Bounds.Width > 0 ? tp.Bounds.Width : 50;

            el.Height = tp.Bounds.Height > 0 ? tp.Bounds.Height : 50;

            // in here tp.Bounds.Width and tp.Bounds.Height is always 0.

            e.Handled = true;
        }

          http://wpf.2000things.com/2013/02/04/748-getting-the-size-of-a-contact-point-during-raw-touch/

     How can I understand this situation ?

     In WPF, this information is not implemented yet ?

     or, is there anything to be considered ?

     please advise me.

     Thanks.

      KI.




    • Edited by bravo701 Tuesday, September 2, 2014 2:33 AM
    Tuesday, September 2, 2014 2:17 AM

Answers

  • Hi Bravo,

    >>The Width and Height information is always 0

    Just from your description, in my experience, it is more related to the type of your touch device.

    Generally, we use stylus and finger to control the touch-screen device.

    Based on your code, I created a simple sample and tested on my Surface.

    By using finger, as we can see, the tp.Bounds.Height and tp.Bounds.Width property were all above zero.

    If we use a stylus, these two properties were always zero.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, September 3, 2014 9:50 AM
    Moderator

All replies

  • TouchDevice class represents a single touch input produced by a finger on a touchscreen.

    Have you tested it by using finger touch?

    Best Regards,
    Please remember to mark the replies as answers if they help

    Wednesday, September 3, 2014 7:31 AM
  • Hi Bravo,

    >>The Width and Height information is always 0

    Just from your description, in my experience, it is more related to the type of your touch device.

    Generally, we use stylus and finger to control the touch-screen device.

    Based on your code, I created a simple sample and tested on my Surface.

    By using finger, as we can see, the tp.Bounds.Height and tp.Bounds.Width property were all above zero.

    If we use a stylus, these two properties were always zero.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, September 3, 2014 9:50 AM
    Moderator