but just on a form itself I get an exception ERROR:.
You wrote : (Parent as Form1)
Then Parent is probably null
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have windows form C# project, where i have a feature to use touch devices with the finger instead of a mouse.
I have added a function which enables to do that:
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case Win32.WM_POINTERDOWN:
case Win32.WM_POINTERUP:
case Win32.WM_POINTERUPDATE:
case Win32.WM_POINTERCAPTURECHANGED:
break;
default:
base.WndProc(ref m);
return;
}
int pointerID = Win32.GET_POINTER_ID(m.WParam);
Win32.POINTER_INFO pi = new Win32.POINTER_INFO();
if (!Win32.GetPointerInfo(pointerID, ref pi))
{
Win32.CheckLastError();
}
Point pt = PointToClient(pi.PtPixelLocation.ToPoint());
MouseEventArgs me = new MouseEventArgs(System.Windows.Forms.MouseButtons.Left, 1, pt.X, pt.Y, 0);
switch (m.Msg)
{
case Win32.WM_POINTERDOWN:
Console.WriteLine("TOCOU" + pt);
(Parent as Form1).Form1_MouseDown((this as object), me);
break;
case Win32.WM_POINTERUP:
Console.WriteLine("LEVANTOU");
(Parent as Form1).Form1_MouseUp((this as object), me);
break;
case Win32.WM_POINTERUPDATE:
Console.WriteLine("UPDATE");
(Parent as Form1).Form1_MouseMove((this as object), me);
break;
}
}
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
}
private void Form1_MouseUp(object sender, MouseEventArgs e)
{
}
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
}
I have tested a Windows Form C# application on the tablet , everything is working, except there is a small bug, when I top with my finger anywhere else except buttons or
pictures, or any controls, but just on a form itself I get an exception ERROR:. I have attached a file, and would be happy to fix this exception ERROR:
Get back, thank in advance.
but just on a form itself I get an exception ERROR:.
You wrote : (Parent as Form1)
Then Parent is probably null
Hi, I have checked another device I still get the same ERROR when tapping on the FORM itself where there is NO object like picture controls or buttons/
I am using SPACEDISK server to test as a second monitor, I am using FIRE tablet and iPhone, I get the same error on both.
Gert back thanks.