How to get the pressure value in the tablet tablet?

I am using a Wacom Bamboo Pen, and I would like to get the pen pressure value in my C # application. How can I do it? Maybe there is an API that allows you to get pen values ​​in Windows 7?

+4
source share
2 answers

Wacom provides an extensive API for retrieving data directly from the tablet. The API includes sample code for determining pressure, tilt, and other interactions:

  • Tilt Test : Demonstrates pressure using eraser properties and manual tilt
  • Pressure Test : Demonstrates how to detect and display pen pressure.

These code samples are in C, but there are also examples that in C # .net include code for handling pressure:

  • WintabDN : Samples of the interface, icon, and tablet using Wintab.NET.

Using this project as an example, you can get this pressure:

// Create a data object and hook a packetlistener to receive // updatse by the tablet m_wtData = new CWintabData(); m_wtData.SetWTPacketEventHandler(handler); //Handles packet receive event void handler(object sender,MessageReceivedEventArgs e) { //Get the packet id uint pktID = (uint)eventArgs_I.Message.WParam; //Get the data for that packet WintabPacket pkt = m_wtData.GetDataPacket((uint)eventArgs_I.Message.LParam, pktID); //Grab the pressure var pressure = pk.pkNormalPressure.pkAbsoluteNormalPressure; } 

Next, here is a CodeProject that explains how to use a Wacom tablet with WPF InkCanvas

Ink APIs are also a good starting point for any spreadsheet development.

+12
source

Source: https://habr.com/ru/post/1488884/


All Articles