如何获得图形手写笔压力值? [英] How to get graphic tablet pen pressure value?
问题描述
我使用的是Wacom的Bamboo笔数位板,我想能在C#编写我的应用程序来获得它的笔压值。我怎么做?是否有可能允许一个在Windows 7上得到笔值的API?
I'm using a Wacom Bamboo Pen tablet and I'd like to be able to get its pen pressure value in my application written in C#. How do I do that? Is there maybe an API that allows one to get pen values on Windows 7?
推荐答案
Wacom公司提供的广泛的API 直接从tablet.The API获取的数据包括用于检测压力,倾斜和其他交互示例代码:
Wacom provides an extensive API to get data directly from the tablet.The API includes example code for detecting pressure, tilt and other interactions:
- Tilt Test: Demonstrates pressure, use of the eraser and pen tilt properties
- Pressure Test: Demonstrates how to detect and display pen pressure
这些代码示例是C,但也有例子,在C#.NET,其中包括代码来处理压力:
These code samples are in C, but there are also examples that in c#.net that include code to handle pressure:
- 的WintabDN :接口,使用Wintab一个.NET涂鸦和平板对照样品
使用这个项目为例,你可以得到这样的压力:
Using this project as an example, you can get the pressure like this:
// 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;
}
接下来,这里是一个的CodeProject 解释如何使用的WPF InkCanvas
Next, here is a CodeProject that explains how to use the Wacom Tablet with the WPF InkCanvas
一个很好的起点在Windows上开发有关的任何平板电脑也是油墨API 。
A good starting point for any tablet related development on windows is also the Ink API.
这篇关于如何获得图形手写笔压力值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!