Hello, XDA's
Due to the discovered HD2 Multitouch captilities I have developed a .net cf dll for easy use.
It converts the Multitouch events to normal Mouse events
SciLor's .NET CF MultiTouch DLL v0.1 adds MultiTouch-Support to your existing .NET CF software very easily (Currently only for the HD2):
If I release a new DLL, it WILL be fully compatible to the previous one!
First of all you will have to add your app to the PinchToZoom Whitelist in the registry:
After adding, soft reset!
Then add the "SciLors-MultiTouch.dll" as reference in your Visual Studio project. Beware, it is not allowed to change the assembly name! It must stay "SciLors-MultiTouch.dll" or it will not work!
Afterwards declare the MultiTouch Class:
VB.NET:
C#:
Then you add following to your Form_Load event:
VB.NET:
C#:
Now, at every MultiTouch Event it gets delegated to your frmMain_Mouse* procedures (There will be always 2 Events fired due to there existing 2 Fingers on the screen
). You can easily detect wheather the mouse event comes from a normal mouse-press or a multitouch finger.
Code Examples:
VB.NET:
C#:
-Multiple Instances are not supported and not needed (Multitouch events fire allways, everywhere on the form)!
-The Mouse-Coordinates are allways relative to the forms top-left corner.
Download at:
http://www.scilor.com/hd2-leo-dotNetCfMultiTouchDLL.html
Due to the discovered HD2 Multitouch captilities I have developed a .net cf dll for easy use.
It converts the Multitouch events to normal Mouse events
SciLor's .NET CF MultiTouch DLL v0.1 adds MultiTouch-Support to your existing .NET CF software very easily (Currently only for the HD2):
If I release a new DLL, it WILL be fully compatible to the previous one!
First of all you will have to add your app to the PinchToZoom Whitelist in the registry:
Code:
[HKEY_LOCAL_MACHINE\Software\HTC\TouchGL\Pinch\WhiteList\YourApp]
"ProcName"="YouAppProcessName.exe"
Then add the "SciLors-MultiTouch.dll" as reference in your Visual Studio project. Beware, it is not allowed to change the assembly name! It must stay "SciLors-MultiTouch.dll" or it will not work!
Afterwards declare the MultiTouch Class:
VB.NET:
Code:
Dim myMultiTouch As New SciLorsMultiTouch.SciLorsMultiTouch
C#:
Code:
SciLorsMultiTouch.SciLorsMultiTouch myMultiTouch = new SciLorsMultiTouch.SciLorsMultiTouch();
Then you add following to your Form_Load event:
VB.NET:
Code:
Call myMultiTouch.CatchWndProc(Me)
AddHandler myMultiTouch.MouseDown, AddressOf frmMain_MouseDown
AddHandler myMultiTouch.MouseMove, AddressOf frmMain_MouseMove
AddHandler myMultiTouch.MouseUp, AddressOf frmMain_MouseUp
C#:
Code:
myMultiTouch.CatchWndProc(this);
myMultiTouch.MouseDown += frmMain_MouseDown;
myMultiTouch.MouseMove += frmMain_MouseMove;
myMultiTouch.MouseUp += frmMain_MouseUp;
Now, at every MultiTouch Event it gets delegated to your frmMain_Mouse* procedures (There will be always 2 Events fired due to there existing 2 Fingers on the screen
Code:
Single Finger:
Windows.Forms.MouseButtons.None or MouseButton = Windows.Forms.MouseButtons.Left
MultiTouch:
Finger 1: Windows.Forms.MouseButtons.Middle
Finger 2: Windows.Forms.MouseButtons.Right
Code Examples:
VB.NET:
Code:
Public Structure MouseState
Dim Position As Point
Dim MouseDown As Boolean
End Structure
Public Fingers(2) As MouseState
Public Sub frmMain_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles frmMain.MouseDown
Dim ButtonID As Byte = ButtonToID(e.Button)
With Fingers(ButtonID)
.Position.X = e.X
.Position.Y = e.Y
.MouseDown = True
End With
End Sub
Public Sub frmMain_MouseMoveByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles frmMain.MouseMove
Dim ButtonID As Byte = ButtonToID(e.Button)
With Fingers(ButtonID)
.Position.X = e.X
.Position.Y = e.Y
.MouseDown = True
End With
End Sub
Public Sub frmMain_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles frmMain.MouseUp
Dim ButtonID As Byte = ButtonToID(e.Button)
With Fingers(ButtonID)
.Position.X = e.X
.Position.Y = e.Y
.MouseDown = False
End With
End Sub
Private Function ButtonToID(ByVal MouseButton As MouseButtons)
If MouseButton = Windows.Forms.MouseButtons.None Or MouseButton = Windows.Forms.MouseButtons.Left Then
Return 0
ElseIf MouseButton = Windows.Forms.MouseButtons.Middle Then
Return 1
Else
Return 2
End If
End Function
C#:
Code:
public struct MouseState
{
public Point Position;
public bool MouseDown;
}
public MouseState[] Fingers = new MouseState[3];
public void pctDraw_MouseDown(object sender, MouseEventArgs e)
{
int ButtonID = Conversions.ToByte(this.ButtonToID(e.Button));
this.Fingers[ButtonID].Position.X = e.X;
this.Fingers[ButtonID].Position.Y = e.Y;
this.Fingers[ButtonID].MouseDown = true;
}
public void pctDraw_MouseMove(object sender, MouseEventArgs e)
{
int ButtonID = Conversions.ToByte(this.ButtonToID(e.Button));
this.Fingers[ButtonID].Position.X = e.X;
this.Fingers[ButtonID].Position.Y = e.Y;
this.Fingers[ButtonID].MouseDown = true;
}
public void pctDraw_MouseUp(object sender, MouseEventArgs e)
{
int ButtonID = Conversions.ToByte(this.ButtonToID(e.Button));
this.Fingers[ButtonID].Position.X = e.X;
this.Fingers[ButtonID].Position.Y = e.Y;
this.Fingers[ButtonID].MouseDown = false;
}
private object ButtonToID(MouseButtons MouseButton)
{
if ((MouseButton == MouseButtons.None) | (MouseButton == MouseButtons.Left))
{
return 0;
}
if (MouseButton == MouseButtons.Middle)
{
return 1;
}
return 2;
}
-Multiple Instances are not supported and not needed (Multitouch events fire allways, everywhere on the form)!
-The Mouse-Coordinates are allways relative to the forms top-left corner.
Download at:
http://www.scilor.com/hd2-leo-dotNetCfMultiTouchDLL.html
Last edited: