I am building a puzzle game in C#, winforms for a touch screen.
I am able to handle touch events on mouse handlers, in fact, i did nothing at all, but it already rec
To perform touch operations correct you should not use the mouse handler event's just because touch and use the mouse handler it is going through a library built to handle touch as mouse and not what you should be using for a game your able to register your application to handle touch events using the methods from user32.dll
, below is an example of how to implement touch handling in your application.
[DllImport("user32.DLL")]
public static extern bool RegisterTouchWindow(IntPtr hwnd, int ulFlags);
[DllImport("user32.DLL")]
public static extern bool UnregisterTouchWindow(IntPtr hwnd);
public Form1()
{
InitializeComponent();
RegisterTouchWindow(button1.Handle, 0);
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
UnregisterTouchWindow(button1.Handle);
}