[]
        
(Showing Draft Content)

C1.Win.TouchToolKit.C1TouchEventProvider

C1TouchEventProvider Class

Represents the component which can be attached to any control, and provide pointer and manipulation events for the attached control.

Inheritance
C1TouchEventProvider
Namespace: C1.Win.TouchToolKit
Assembly: C1.Win.C1TouchToolKit.4.8.dll
Syntax
[ToolboxBitmap(typeof(C1TouchEventProvider), "TouchEventProvider.png")]
public class C1TouchEventProvider : Component, IComponent, IExtenderProvider, IDisposable
Examples

The following code example shows how to use C1TouchEventProvider component.

You can copy the code to a exsit Windows Forms appliction. And set the form in the sample code as start form.

If you find a licenses error when run this code. Try to drag a C1TouchEventProvider component to a any Form from tool box can generate the licenses information to this project.

public class GcTouchEventProviderDemo : Form
{
	private Panel _bluePanel;
	private Panel _redPanel;
	private Button _clearButton;
	private ListBox _messageListBox;

	private GcTouchEventProvider _gcTouchEventProvider = new GcTouchEventProvider();

	public GcTouchEventProviderDemo()
	{
		InitializeComponent();

		// Enable all manipulation interaction modes.
		_gcTouchEventProvider.ManipulationMode = ManipulationModes.All;

		// EnablePressAndHold and EnablePenFlicks property default value is True

		// Attach GcTouchEventprovider to Panel.
		_gcTouchEventProvider.SetEnableTouchEvents(_bluePanel, true);
		_gcTouchEventProvider.SetEnableTouchEvents(_redPanel, true);
		Console.WriteLine(_gcTouchEventProvider.GetEnableTouchEvents(_bluePanel).ToString());
		Console.WriteLine(_gcTouchEventProvider.GetEnableTouchEvents(_redPanel).ToString());

		_clearButton.Click += _clearButton_Click;

		_gcTouchEventProvider.Tapped += _gcTouchEventProvider_Tapped;
		_gcTouchEventProvider.DoubleTapped += _gcTouchEventProvider_DoubleTapped;
		_gcTouchEventProvider.Holding += _gcTouchEventProvider_Holding;
		_gcTouchEventProvider.ManipulationStarting += _gcTouchEventProvider_ManipulationStarting;
		_gcTouchEventProvider.ManipulationStarted += _gcTouchEventProvider_ManipulationStarted;
		_gcTouchEventProvider.ManipulationDelta += _gcTouchEventProvider_ManipulationDelta;
		_gcTouchEventProvider.ManipulationInertiaStarting += _gcTouchEventProvider_ManipulationInertiaStarting;
		_gcTouchEventProvider.ManipulationCompleted += _gcTouchEventProvider_ManipulationCompleted;
		_gcTouchEventProvider.RightTapped += _gcTouchEventProvider_RightTapped;
	}

	private void _gcTouchEventProvider_Tapped(object sender, TappedEventArgs e)
	{
		string log = "Target: " + e.TargetControl.Name + " Event: Tapped" + "  X: " + e.Position.X.ToString() + " Y:" + e.Position.Y.ToString();
		_messageListBox.Items.Add(log);
	}

	private void _gcTouchEventProvider_DoubleTapped(object sender, DoubleTappedEventArgs e)
	{
		string log = "Target: " + e.TargetControl.Name + " Event: DoubleTapped" + "  X: " + e.Position.X.ToString() + " Y:" + e.Position.Y.ToString();
		_messageListBox.Items.Add(log);
	}

	private void _gcTouchEventProvider_Holding(object sender, HoldingEventArgs e)
	{
		string log = "Target: " + e.TargetControl.Name + " Event: Holding" + "  X: " + e.Position.X.ToString() + " Y:" + e.Position.Y.ToString();
		_messageListBox.Items.Add(log);
	}

	private void _gcTouchEventProvider_ManipulationStarting(object sender, ManipulationStartingEventArgs e)
	{
		string log = "Target: " + e.TargetControl.Name + " Event: ManipulationStarting" + "  X: " + e.Position.X.ToString() + " Y:" + e.Position.Y.ToString();
		_messageListBox.Items.Add(log);
	}

	private void _gcTouchEventProvider_ManipulationStarted(object sender, ManipulationStartedEventArgs e)
	{
		string log = "Target: " + e.TargetControl.Name + " Event: ManipulationStarted" + "  X: " + e.Position.X.ToString() + " Y:" + e.Position.Y.ToString();
		_messageListBox.Items.Add(log);
	}

	private void _gcTouchEventProvider_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
	{
		string log = "Target: " + e.TargetControl.Name + " Event: ManipulationDelta" + "  X: " + e.Position.X.ToString() + " Y:" + e.Position.Y.ToString();
		_messageListBox.Items.Add(log);
	}

	private void _gcTouchEventProvider_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingEventArgs e)
	{
		string log = "Target: " + e.TargetControl.Name + " Event: ManipulationInertiaStarting" + "  Velocities: " + e.Velocities.Linear.ToString();
		_messageListBox.Items.Add(log);
	}

	private void _gcTouchEventProvider_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
	{
		string log = "Target: " + e.TargetControl.Name + " Event: ManipulationCompleted" + "  X: " + e.Position.X.ToString() + " Y:" + e.Position.Y.ToString();
		_messageListBox.Items.Add(log);
	}

	private void _gcTouchEventProvider_RightTapped(object sender, RightTappedEventArgs e)
	{
		string log = "Target: " + e.TargetControl.Name + " Event: RightTapped" + "  X: " + e.Position.X.ToString() + " Y:" + e.Position.Y.ToString();
		_messageListBox.Items.Add(log);
	}

	private void _clearButton_Click(object sender, EventArgs e)
	{
		_messageListBox.Items.Clear();
	}

	private void InitializeComponent()
	{
		_bluePanel = new Panel();
		_bluePanel.Name = "Blue";
		_bluePanel.BackColor = Color.Blue;
		_bluePanel.Size = new Size(200, 200);
		_bluePanel.Location = new Point(20, 20);

		_redPanel = new Panel();
		_redPanel.Name = "Red";
		_redPanel.BackColor = Color.Red;
		_redPanel.Size = new Size(200, 200);
		_redPanel.Location = new Point(240, 20);

		_clearButton = new Button();
		_clearButton.Text = "Clear List";
		_clearButton.Location = new Point(460, 200);

		_messageListBox = new ListBox();
		_messageListBox.Size = new Size(750, 310);
		_messageListBox.Location = new Point(20, 240);

		this.Controls.Add(_bluePanel);
		this.Controls.Add(_redPanel);
		this.Controls.Add(_clearButton);
		this.Controls.Add(_messageListBox);
		this.Size = new Size(800, 600);
	}
}
Public Class GcTouchEventProviderDemo
	Inherits Form
	Private _bluePanel As Panel
	Private _redPanel As Panel
	Private _clearButton As Button
	Private _messageListBox As ListBox

	Private _gcTouchEventProvider As New GcTouchEventProvider()

	Public Sub New()
		InitializeComponent()

		' Enable all manipulation interaction modes.
		_gcTouchEventProvider.ManipulationMode = ManipulationModes.All

		' EnablePressAndHold and EnablePenFlicks property default value is True

		' Attach GcTouchEventprovider to Panel.
		_gcTouchEventProvider.SetEnableTouchEvents(_bluePanel, True)
		_gcTouchEventProvider.SetEnableTouchEvents(_redPanel, True)
		Console.WriteLine(_gcTouchEventProvider.GetEnableTouchEvents(_bluePanel).ToString())
		Console.WriteLine(_gcTouchEventProvider.GetEnableTouchEvents(_redPanel).ToString())

		AddHandler _clearButton.Click, AddressOf _clearButton_Click

		AddHandler _gcTouchEventProvider.Tapped, AddressOf _gcTouchEventProvider_Tapped
		AddHandler _gcTouchEventProvider.DoubleTapped, AddressOf _gcTouchEventProvider_DoubleTapped
		AddHandler _gcTouchEventProvider.Holding, AddressOf _gcTouchEventProvider_Holding
		AddHandler _gcTouchEventProvider.ManipulationStarting, AddressOf _gcTouchEventProvider_ManipulationStarting
		AddHandler _gcTouchEventProvider.ManipulationStarted, AddressOf _gcTouchEventProvider_ManipulationStarted
		AddHandler _gcTouchEventProvider.ManipulationDelta, AddressOf _gcTouchEventProvider_ManipulationDelta
		AddHandler _gcTouchEventProvider.ManipulationInertiaStarting, AddressOf _gcTouchEventProvider_ManipulationInertiaStarting
		AddHandler _gcTouchEventProvider.ManipulationCompleted, AddressOf _gcTouchEventProvider_ManipulationCompleted
		AddHandler _gcTouchEventProvider.RightTapped, AddressOf _gcTouchEventProvider_RightTapped
	End Sub

	Private Sub _gcTouchEventProvider_Tapped(sender As Object, e As TappedEventArgs)
		Dim log As String = "Target: " & Convert.ToString(e.TargetControl.Name) & " Event: Tapped" & "  X: " & e.Position.X.ToString() & " Y:" & e.Position.Y.ToString()
		_messageListBox.Items.Add(log)
	End Sub

	Private Sub _gcTouchEventProvider_DoubleTapped(sender As Object, e As DoubleTappedEventArgs)
		Dim log As String = "Target: " & Convert.ToString(e.TargetControl.Name) & " Event: DoubleTapped" & "  X: " & e.Position.X.ToString() & " Y:" & e.Position.Y.ToString()
		_messageListBox.Items.Add(log)
	End Sub

	Private Sub _gcTouchEventProvider_Holding(sender As Object, e As HoldingEventArgs)
		Dim log As String = "Target: " & Convert.ToString(e.TargetControl.Name) & " Event: Holding" & "  X: " & e.Position.X.ToString() & " Y:" & e.Position.Y.ToString()
		_messageListBox.Items.Add(log)
	End Sub

	Private Sub _gcTouchEventProvider_ManipulationStarting(sender As Object, e As ManipulationStartingEventArgs)
		Dim log As String = "Target: " & Convert.ToString(e.TargetControl.Name) & " Event: ManipulationStarting" & "  X: " & e.Position.X.ToString() & " Y:" & e.Position.Y.ToString()
		_messageListBox.Items.Add(log)
	End Sub

	Private Sub _gcTouchEventProvider_ManipulationStarted(sender As Object, e As ManipulationStartedEventArgs)
		Dim log As String = "Target: " & Convert.ToString(e.TargetControl.Name) & " Event: ManipulationStarted" & "  X: " & e.Position.X.ToString() & " Y:" & e.Position.Y.ToString()
		_messageListBox.Items.Add(log)
	End Sub

	Private Sub _gcTouchEventProvider_ManipulationDelta(sender As Object, e As ManipulationDeltaEventArgs)
		Dim log As String = "Target: " & Convert.ToString(e.TargetControl.Name) & " Event: ManipulationDelta" & "  X: " & e.Position.X.ToString() & " Y:" & e.Position.Y.ToString()
		_messageListBox.Items.Add(log)
	End Sub

	Private Sub _gcTouchEventProvider_ManipulationInertiaStarting(sender As Object, e As ManipulationInertiaStartingEventArgs)
		Dim log As String = "Target: " & Convert.ToString(e.TargetControl.Name) & " Event: ManipulationInertiaStarting" & "  Velocities: " & e.Velocities.Linear.ToString()
		_messageListBox.Items.Add(log)
	End Sub

	Private Sub _gcTouchEventProvider_ManipulationCompleted(sender As Object, e As ManipulationCompletedEventArgs)
		Dim log As String = "Target: " & Convert.ToString(e.TargetControl.Name) & " Event: ManipulationCompleted" & "  X: " & e.Position.X.ToString() & " Y:" & e.Position.Y.ToString()
		_messageListBox.Items.Add(log)
	End Sub

	Private Sub _gcTouchEventProvider_RightTapped(sender As Object, e As RightTappedEventArgs)
		Dim log As String = "Target: " & Convert.ToString(e.TargetControl.Name) & " Event: RightTapped" & "  X: " & e.Position.X.ToString() & " Y:" & e.Position.Y.ToString()
		_messageListBox.Items.Add(log)
	End Sub

	Private Sub _clearButton_Click(sender As Object, e As EventArgs)
		_messageListBox.Items.Clear()
	End Sub

	Private Sub InitializeComponent()
		_bluePanel = New Panel()
		_bluePanel.Name = "Blue"
		_bluePanel.BackColor = Color.Blue
		_bluePanel.Size = New Size(200, 200)
		_bluePanel.Location = New Point(20, 20)

		_redPanel = New Panel()
		_redPanel.Name = "Red"
		_redPanel.BackColor = Color.Red
		_redPanel.Size = New Size(200, 200)
		_redPanel.Location = New Point(240, 20)

		_clearButton = New Button()
		_clearButton.Text = "Clear List"
		_clearButton.Location = New Point(460, 200)

		_messageListBox = New ListBox()
		_messageListBox.Size = New Size(750, 310)
		_messageListBox.Location = New Point(20, 240)

		Me.Controls.Add(_bluePanel)
		Me.Controls.Add(_redPanel)
		Me.Controls.Add(_clearButton)
		Me.Controls.Add(_messageListBox)
		Me.Size = New Size(800, 600)
	End Sub
End Class

Constructors

Name Description
C1TouchEventProvider()

Initializes a new instance of the C1TouchEventProvider class.

Properties

Name Description
EnablePenFlicks

Gets or sets a value indicating whether the control supports the pen flicks gesture.

EnablePressAndHold

Gets or sets a value indicating whether the control supports the press and hold (right-click) gesture.

ManipulationMode

Gets or sets the ManipulationModes value used for Control behavior and interaction with gestures.

MaximunTouches

Gets the aggregate maximum of the maximum number of contacts supported by every digitizer in the system.

Methods

Name Description
AboutBox()

Shows the product information window.

CanExtend(object)

Specifies whether this object can provide its extender properties to the specified object.

Dispose(bool)

Releases the unmanaged resources used by the Component and optionally releases the managed resources.

GetEnableTouchEvents(Control)

Retrieves the C1TouchEventProvider associated with the specified control or not.

OnDoubleTapped(DoubleTappedEventArgs)

Raises the DoubleTapped event.

OnHolding(HoldingEventArgs)

Raises the Holding event.

OnManipulationCompleted(ManipulationCompletedEventArgs)

Raises the ManipulationCompleted event.

OnManipulationDelta(ManipulationDeltaEventArgs)

Raises the ManipulationDelta event.

OnManipulationInertiaStarting(ManipulationInertiaStartingEventArgs)

Raises the ManipulationInertiaStarting event.

OnManipulationStarted(ManipulationStartedEventArgs)

Raises the ManipulationStarted event.

OnManipulationStarting(ManipulationStartingEventArgs)

Raises the ManipulationStarting event.

OnPointerCanceled(PointerEventArgs)

Raises the PointerCanceled event.

OnPointerCaptureLost(PointerEventArgs)

Raises the PointerCaptureLost event.

OnPointerEntered(PointerEventArgs)

Raises the PointerEntered event.

OnPointerExited(PointerEventArgs)

Raises the PointerExited event.

OnPointerMoved(PointerEventArgs)

Raises the PointerMoved event.

OnPointerPressed(PointerEventArgs)

Raises the PointerPressed event.

OnPointerReleased(PointerEventArgs)

Raises the PointerReleased event.

OnRightTapped(RightTappedEventArgs)

Raises the RightTapped event.

OnTapped(TappedEventArgs)

Raises the Tapped event.

SetEnableTouchEvents(Control, bool)

Associates C1TouchEventProvider with the specified control.

Events

Name Description
DoubleTapped

Occurs when an otherwise unhandled DoubleTap interaction occurs over the hit test area of the specific control.

Holding

Occurs when an otherwise unhandled Hold interaction occurs over the hit test area of the specific control.

ManipulationCompleted

Occurs when a manipulation on the specific control is complete.

ManipulationDelta

Occurs when the input device changes position during a manipulation.

ManipulationInertiaStarting

Occurs when the input device loses contact with the specific control during a manipulation and inertia begins.

ManipulationStarted

Occurs when an input device begins a manipulation on the specific control.

ManipulationStarting

Occurs when the manipulation processor is first created.

PointerCanceled

Occurs when a pointer that made contact abnormally loses contact.

PointerCaptureLost

Occurs when pointer capture previously held by the specific control moves to another control or elsewhere.

PointerEntered

Occurs when a pointer enters the hit test area of the specific control.

PointerExited

Occurs when a pointer leaves the hit test area of the specific control.

PointerMoved

Occurs when a pointer moves while the pointer remains within the hit test area of the specific control.

PointerPressed

Occurs when the pointer device initiates a Press action within the specific control.

PointerReleased

Occurs when the pointer device that previously initiated a Press action is released, while within the specific control. Note that the end of a Press action is not guaranteed to fire a PointerReleased event; other events may fire instead. For more info, see Remarks.

RightTapped

Occurs when a right-tap input stimulus happens while the pointer is over the specific control.

Tapped

Occurs when an otherwise unhandled Tap interaction occurs over the hit test area of the specific control.