Hello, I’m an oldtime user of vvvv delta.
Getting into gamma right now and creating a drawing app using the realtime stylus api. Now I want to make same realtime onscreen controls for color, brushes etc. The problem I have is that touch events also get registered as mouse input and this makes the stylus input stop. If i’m already drawing and then touch the screen it’s fine and it keeps working, but if I first touch and then try to draw the pen input doesn’t work. So now I’m looking for a method so I can define a region on screen where touch events doesn’t get processed as mouse input.
I’m a visual artist and don’t have a background in coding. While I did manage to implement the realtime stylus api (took me a few days with the help of chatgpt :) ), right now I’m stuck.
I asked chatgpt again for the best method :)
this is the example code it:
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
public class MainForm : Form
{
// Define the constants for touch window flags
private const uint TWF_WANTPALM = 0x2; // Suppresses mouse emulation
private const uint TWF_FINETOUCH = 0x1; // Fine touch input (optional)
// Import the RegisterTouchWindow function from User32.dll
[DllImport("user32.dll")]
public static extern bool RegisterTouchWindow(IntPtr hwnd, uint ulFlags);
public MainForm()
{
this.Text = "Touch Area Example";
this.Size = new System.Drawing.Size(400, 300);
this.Paint += new PaintEventHandler(MainForm_Paint);
// Register this window to receive touch input and suppress mouse emulation
RegisterTouchWindow(this.Handle, TWF_WANTPALM);
}
private void MainForm_Paint(object sender, PaintEventArgs e)
{
// Example code to paint the form (e.g., drawing a rectangle)
e.Graphics.DrawRectangle(System.Drawing.Pens.Black, 50, 50, 200, 100);
}
public static void Main()
{
Application.Run(new MainForm());
}
}