TouchToolKit for WinForms | ComponentOne
Touch Event Provider / Detecting Maximum Touch Count
In This Topic
    Detecting Maximum Touch Count
    In This Topic

    In order to get the maximum touch count capability on the system, you can use the C1TouchEventProvider.MaximumTouches static property. You can detect Windows 8 and Windows Server 2012 by using the IsWindows8 function and then you can show a message to the users whether or not the multi-touch is supported like in the following code:

     

    [C#]

    using C1.Win.TouchToolKit;

     

    // Returns true if the OS is Windows 8, Windows Server 2012 or newer. Otherwise false.

    private static bool IsWindows8()

    {

        if (Environment.OSVersion.Version.Major >= 6 && Environment.OSVersion.Version.Minor >= 2) return true;

        return false;

    }

     

    private void button1_Click(object sender, EventArgs e)

    {

        if (C1TouchEventProvider.MaximunTouches < 2 || IsWindows8() == false)

        {

            MessageBox.Show("This is Unsupported environment.");

        }

        else

        {

            MessageBox.Show("This is Supported environment.");

        }

    }

     

    [Visual Basic]

    Imports C1.Win.TouchToolKit

     

    ' Returns true if the OS is Windows 8, Windows Server 2012 or newer. Otherwise false.

    Private Shared Function IsWindows8()

        If Environment.OSVersion.Version.Major >= 6 AndAlso Environment.OSVersion.Version.Minor >= 2 Then Return True

        Return False

    End Function

     

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

        If C1TouchEventProvider.MaximunTouches < 2 AndAlso IsWindows8() = False Then

            MessageBox.Show("This is Unsupported environment.")

        Else

            MessageBox.Show("This is Supported environment.")

        End If

    End Sub