Capturing mousedown in class and passing event back to form.
Hi all,
I have been playing with trying to add gestures to my mobile applications.
I seem to have all the bits to do it, but cannot seem to get it all working.
I'm starting off with this example.
Form1 Code
Code:
namespace SmartDeviceProject1
{
public partial class Form1 : Form
{
private void button2_Click(object sender, EventArgs e)
{
this.Hide();
}
Class Code
Code:
using System;
using System.Windows.Forms;
using Microsoft.WindowsCE.Forms;
using OpenNETCF.Win32;
using OpenNETCF.Windows.Forms;
namespace SmartDeviceProject1
{
static class Program
{
[MTAThread]
static void Main()
{
Form1 frm = new Form1();
MessageInterceptor interceptor = new MessageInterceptor(frm);
Application2.AddMessageFilter(interceptor);
Application2.Run(frm);
}
}
class MessageInterceptor : IMessageFilter
{
Form frm;
public MessageInterceptor(Form frm)
{
this.frm = frm;
}
public bool PreFilterMessage(ref Message m)
{
switch (m.Msg)
{
case (int)WM.APP + 1: //0x8001
frm.Show();
break;
default:
break;
}
return false;
}
}
}
This does file capture messages, but they do not seem to be right for the switch statement.
The WM class provides more events to choose from, but none seem to be correct.
Once I capture this I'll get the x and y co-ords from the main form, which I think I can do then fire events back to it.. Which again I'm having issues with..
I've not had much time to play, but if anyone has some working code, VB or C# then I'd much appreciate it.
Cheers,
Paul.