none
Rubberband Line and Rubberband Rectangle Anomaly on Surface Pro 2 / Win8.1 RRS feed

  • Question

  • I was adding a rubberband-line routine to one of my C# programs (using Visual Studio Community Edition 2013) the other day and ran into an interesting problem.

    The routine uses the MouseDown/Move/Up events in the usual way to control the drawing of a line that always stretches from the mouse-down point to the mouse-move point. The line is drawn using ControlPaint.DrawReversibleLine.

    Everything works perfectly on my Win7 Desktop PC, but on moving the exe to my Win8.1 Surface Pro 2 (in desktop mode), the drawn rubberband-line is offset from the actual mouse positions by a factor of 2/3. In other words, the rubberband-line drawn by ControlPaint.DrawReversibleLine appears above and to the left of the actual mouse cursor.

    This is the first discrepancy I have noticed between a program running on Win7 and my Win8.1 Surface. The fix is simple: just detect which machine is being used and offset the points by a factor of 3/2 if necessary. However, I wonder if something more fundamental is going on. ControlPaint.DrawReversibleFrame behaves in the same way.

    Incidentally, I notice that my Avast anti-virus program will run a "new" exe in a sandbox it calls DeepScreen first. During this phase, the rubberband on the Surface behaves correctly! Only after Avast releases the exe for normal operations does the anomalous behaviour return.

    I have written a minimalist C# program (about 100 lines) that shows this behaviour on my machines if anyone is interested.

    Am I missing something obvious? Has anyone else encountered this?

    Thanks for any suggestions.




    • Edited by JDRoger Thursday, February 5, 2015 9:13 PM
    • Moved by Kristin Xie Friday, February 6, 2015 8:04 AM
    Thursday, February 5, 2015 9:09 PM

All replies

  • Hi,

    >>Everything works perfectly on my Win7 Desktop PC, but on moving the exe to my Win8.1 Surface Pro 2 (in desktop mode), the drawn rubberband-line is offset from the actual mouse positions by a factor of 2/3.

    So it doesn't work better on Win8.1 Surface Pro2.  Per my understanding, there are two different platforms. They have different is to be expected.  Now i will move your thread to Surface Application Design and Development forum for better support.

    In addtion, it could be better to post some screenshots to help us understand more about your issue. Thanks.

    Best regards,

    Kristin


    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.

    Friday, February 6, 2015 8:04 AM
  • As requested, here is an animated gif showing the offset...

    ControlPaint.DrawReversibleLine anomaly on Surface Pro 2 (Win 8.1)

    There must be some significance to the fact that the screen co-ordinates of the "reversible line" points are exactly 2/3 of the screen co-ordinates of the mouse points.

    Friday, February 6, 2015 5:10 PM
  • OK, I think I've figured this out (not that many people have seen this post!).

    My Win 8.1 Surface 2 Pro has a Control Panel> Display setting that allows items on the screen to be scaled up from the actual size ('Smaller') to medium or 'Larger'. Medium scales by 5/4, while Larger, which is the setting I'm using, scales by 3/2. That must be where that factor of 2/3 I mentioned above comes into play.

    Wednesday, March 18, 2015 6:15 PM