Technology Questions

Go Back   Technology Questions > Hardware Questions > Mobile Computers > Tablet PC > Tablet PC Software > Tablet PC Developers

Tablet PC Developers Show off your work while discussing with others how to create ink enabled applications.

Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old 06-29-2007, 12:39 AM
Registered User
 
Join Date: Jun 2007
Posts: 2
AndreasL is on a distinguished road
Absolut Coordinates

Hi,

I am currently working on a project where we need to be able to get the absolute coordinates of the the pen on the digitizer (preferably in centimeters).
I have tried to use RealTimeStylus by implementing the IStylusSyncPlugin interface and reading the PacketsData but this seems to only contain the position of the cursor relative to the current window (Form).

So my question is what is the best way of getting the absolute position of the pen on the digitizer?


Any help or pointers would be much appreciated.

/Andreas
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

 
Old 06-29-2007, 12:39 AM
  #2 (permalink)  
Old 06-29-2007, 01:50 PM
Josh Einstein
Newsgroup Contributor
 
Posts: n/a
Re: Absolut Coordinates

Well

1) if its acceptable that the coordinates are only reported when the stylus
is over your window, you can always convert the relative coordinates to
screen coordinates by using standard translation methods such as
PointToScreen. For example, you can do:

Point origin = myWindow.PointToScreen(new Point(0,0));
myRenderer.PixelToInkSpace(myGraphics, ref origin);

// Now the origin variable contains a point in inkspace coordinates
// that represents the upper-left of the window's client area
// So you can get the absolute position of the cursor by adding this to
// the relative coordinate you get from RealTimeStylus.

Point screenCoords = origin;
screenCoords.Offset(relativeCoords);

2) If you don't need the accuracy of the digitizer (which has a much higher
resolution than pixels) you can install a low-level mouse hook, and convert
the screen pixel coordinates to ink space using the same mechanism above. I
wrote an article about how to do this but to my knowledge it has not been
posted on MSDN so I can't even link to it.

3) You can access the HID stream directly but I have no idea how to do this
or even where to begin and it's quite a chore from what I understand.

--
Josh Einstein (Tablet PC MVP)
Einstein Technologies
Tablet Enhancements for Outlook - Try it free: www.tabletoutlook.com


"AndreasL" <andreas.lindmark@capab.se> wrote in message
news:AndreasL.2sxidj@no-mx.tabletquestions.com...
>
> Hi,
>
> I am currently working on a project where we need to be able to get the
> absolute coordinates of the the pen on the digitizer (preferably in
> centimeters).
> I have tried to use RealTimeStylus by implementing the
> IStylusSyncPlugin interface and reading the PacketsData but this seems
> to only contain the position of the cursor relative to the current
> window (Form).
>
> So my question is what is the best way of getting the absolute position
> of the pen on the digitizer?
>
>
> Any help or pointers would be much appreciated.
>
> /Andreas
>
>
> --
> AndreasL


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #3 (permalink)  
Old 07-03-2007, 01:15 AM
Registered User
 
Join Date: Jun 2007
Posts: 2
AndreasL is on a distinguished road
Re: Absolut Coordinates

It seems like I have to go with option number 3. The HID stream.
I haven't found any information on how to do this with a tablet, but if I get any results I'll try to post them here.

Thanks for the help.


Quote:
Originally Posted by Josh Einstein View Post
Well

1) if its acceptable that the coordinates are only reported when the stylus
is over your window, you can always convert the relative coordinates to
screen coordinates by using standard translation methods such as
PointToScreen. For example, you can do:

Point origin = myWindow.PointToScreen(new Point(0,0));
myRenderer.PixelToInkSpace(myGraphics, ref origin);

// Now the origin variable contains a point in inkspace coordinates
// that represents the upper-left of the window's client area
// So you can get the absolute position of the cursor by adding this to
// the relative coordinate you get from RealTimeStylus.

Point screenCoords = origin;
screenCoords.Offset(relativeCoords);

2) If you don't need the accuracy of the digitizer (which has a much higher
resolution than pixels) you can install a low-level mouse hook, and convert
the screen pixel coordinates to ink space using the same mechanism above. I
wrote an article about how to do this but to my knowledge it has not been
posted on MSDN so I can't even link to it.

3) You can access the HID stream directly but I have no idea how to do this
or even where to begin and it's quite a chore from what I understand.

--
Josh Einstein (Tablet PC MVP)
Einstein Technologies
Tablet Enhancements for Outlook - Try it free: Tablet Enhancements for Outlook for Tablet PC, UMPC, Origami
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



New To Technology Questions? Do You Need Help with Your Computer or Device? Do You Need Help with this site?

All times are GMT -8. The time now is 05:43 PM.


2003 - 2009 All Rights Reserved. Technology Questions

Search Engine Friendly URLs by vBSEO 3.3.0