10/03/12 20:55:17
VisualStudio2008 SP1 VC# 2008
WPF3.5 で開発しています。
[DllImport("user32.dll")]
public static extern bool SetProp(IntPtr hWnd, string lpString, IntPtr hData);
this.Loaded += new RoutedEventHandler(
delegate(object sender, RoutedEventArgs arg) {
var source = new WindowInteropHelper(this);
SetProp(source.Handle,
"MicrosoftTabletPenServiceProperty", new IntPtr(0x01000000));
}
);
によってマルチタッチを有効にし(これはMSDNのサンプルからも得られる知識です)、
Stylusイベントによってマルチタッチアプリを開発しています。
参考になるサイトは以下です。
URLリンク(blog.andreweichacker.com)
MSDNのサンプル、↑のブログ、その他海外のサイト、どこを見ても
StylusDown, Up によってタッチの有無を判定していますが、
StylusEnter, Leave を用いたものを見たことがありません。
試しに Enter, Leave のイベントを記述し、対応する関数内で
(たとえば)listBox1.Items.Insert(0, "Stylus Enter" + e.StylusDevice.ID);
などと記述すると、Enter, Leave は問題なく取得できています。
が、1本目の指で StylusEnter し、2本目の指をウィンドウ内にタッチすると
Enter, Leave が暴走します。
(※すみません、次のレスに続きます)