Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Windows 8-使用c在电阻式触摸屏上模拟手势#_C#_Windows 8_Touch_Gesture_Hardware Interface - Fatal编程技术网

C# Windows 8-使用c在电阻式触摸屏上模拟手势#

C# Windows 8-使用c在电阻式触摸屏上模拟手势#,c#,windows-8,touch,gesture,hardware-interface,C#,Windows 8,Touch,Gesture,Hardware Interface,有没有办法在电阻式触摸屏设备上使用映射有C#界面的物理键盘键来模拟Windows8的手势(缩放、旋转、滑动) 我的设置是一个经典的桌面Windows 8应用程序,有两种屏幕类型(电阻式和电容式触摸屏)。在电阻式屏幕上,无法识别多点触摸手势,可以使用键盘组合或映射键(此设备上没有鼠标)来完成多点触摸手势。Windows 8提供本机功能,您可以从C#进行p调用,以合成可转换为手势的指针输入 在C++中演示了这个。 由 public partial class NativeConstants {

有没有办法在电阻式触摸屏设备上使用映射有C#界面的物理键盘键来模拟Windows8的手势(缩放、旋转、滑动)

我的设置是一个经典的桌面Windows 8应用程序,有两种屏幕类型(电阻式和电容式触摸屏)。在电阻式屏幕上,无法识别多点触摸手势,可以使用键盘组合或映射键(此设备上没有鼠标)来完成多点触摸手势。

Windows 8提供本机功能,您可以从C#进行p调用,以合成可转换为手势的指针输入

在C++中演示了这个。 由

public partial class NativeConstants {

    /// TOUCH_FLAG_NONE -> 0x00000000
    public const int TOUCH_FLAG_NONE = 0;

    /// TOUCH_MASK_NONE -> 0x00000000
    public const int TOUCH_MASK_NONE = 0;

    /// TOUCH_MASK_CONTACTAREA -> 0x00000001
    public const int TOUCH_MASK_CONTACTAREA = 1;

    /// TOUCH_MASK_ORIENTATION -> 0x00000002
    public const int TOUCH_MASK_ORIENTATION = 2;

    /// TOUCH_MASK_PRESSURE -> 0x00000004
    public const int TOUCH_MASK_PRESSURE = 4;

    /// POINTER_FLAG_NONE -> 0x00000000
    public const int POINTER_FLAG_NONE = 0;

    /// POINTER_FLAG_NEW -> 0x00000001
    public const int POINTER_FLAG_NEW = 1;

    /// POINTER_FLAG_INRANGE -> 0x00000002
    public const int POINTER_FLAG_INRANGE = 2;

    /// POINTER_FLAG_INCONTACT -> 0x00000004
    public const int POINTER_FLAG_INCONTACT = 4;

    /// POINTER_FLAG_FIRSTBUTTON -> 0x00000010
    public const int POINTER_FLAG_FIRSTBUTTON = 16;

    /// POINTER_FLAG_SECONDBUTTON -> 0x00000020
    public const int POINTER_FLAG_SECONDBUTTON = 32;

    /// POINTER_FLAG_THIRDBUTTON -> 0x00000040
    public const int POINTER_FLAG_THIRDBUTTON = 64;

    /// POINTER_FLAG_FOURTHBUTTON -> 0x00000080
    public const int POINTER_FLAG_FOURTHBUTTON = 128;

    /// POINTER_FLAG_FIFTHBUTTON -> 0x00000100
    public const int POINTER_FLAG_FIFTHBUTTON = 256;

    /// POINTER_FLAG_PRIMARY -> 0x00002000
    public const int POINTER_FLAG_PRIMARY = 8192;

    /// POINTER_FLAG_CONFIDENCE -> 0x00004000
    public const int POINTER_FLAG_CONFIDENCE = 16384;

    /// POINTER_FLAG_CANCELED -> 0x00008000
    public const int POINTER_FLAG_CANCELED = 32768;

    /// POINTER_FLAG_DOWN -> 0x00010000
    public const int POINTER_FLAG_DOWN = 65536;

    /// POINTER_FLAG_UPDATE -> 0x00020000
    public const int POINTER_FLAG_UPDATE = 131072;

    /// POINTER_FLAG_UP -> 0x00040000
    public const int POINTER_FLAG_UP = 262144;

    /// POINTER_FLAG_WHEEL -> 0x00080000
    public const int POINTER_FLAG_WHEEL = 524288;

    /// POINTER_FLAG_HWHEEL -> 0x00100000
    public const int POINTER_FLAG_HWHEEL = 1048576;

    /// POINTER_FLAG_CAPTURECHANGED -> 0x00200000
    public const int POINTER_FLAG_CAPTURECHANGED = 2097152;

    /// POINTER_FLAG_HASTRANSFORM -> 0x00400000
    public const int POINTER_FLAG_HASTRANSFORM = 4194304;
}

public enum tagPOINTER_INPUT_TYPE {

    /// PT_POINTER -> 0x00000001
    PT_POINTER = 1,

    /// PT_TOUCH -> 0x00000002
    PT_TOUCH = 2,

    /// PT_PEN -> 0x00000003
    PT_PEN = 3,

    /// PT_MOUSE -> 0x00000004
    PT_MOUSE = 4,

    /// PT_TOUCHPAD -> 0x00000005
    PT_TOUCHPAD = 5,
}

public enum tagPOINTER_BUTTON_CHANGE_TYPE {

    POINTER_CHANGE_NONE,

    POINTER_CHANGE_FIRSTBUTTON_DOWN,

    POINTER_CHANGE_FIRSTBUTTON_UP,

    POINTER_CHANGE_SECONDBUTTON_DOWN,

    POINTER_CHANGE_SECONDBUTTON_UP,

    POINTER_CHANGE_THIRDBUTTON_DOWN,

    POINTER_CHANGE_THIRDBUTTON_UP,

    POINTER_CHANGE_FOURTHBUTTON_DOWN,

    POINTER_CHANGE_FOURTHBUTTON_UP,

    POINTER_CHANGE_FIFTHBUTTON_DOWN,

    POINTER_CHANGE_FIFTHBUTTON_UP,
}

[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public struct tagPOINTER_INFO {

    /// POINTER_INPUT_TYPE->DWORD->unsigned int
    public uint pointerType;

    /// UINT32->unsigned int
    public uint pointerId;

    /// UINT32->unsigned int
    public uint frameId;

    /// POINTER_FLAGS->UINT32->unsigned int
    public uint pointerFlags;

    /// HANDLE->void*
    public System.IntPtr sourceDevice;

    /// HWND->HWND__*
    public System.IntPtr hwndTarget;

    /// POINT->tagPOINT
    public Point ptPixelLocation;

    /// POINT->tagPOINT
    public Point ptHimetricLocation;

    /// POINT->tagPOINT
    public Point ptPixelLocationRaw;

    /// POINT->tagPOINT
    public Point ptHimetricLocationRaw;

    /// DWORD->unsigned int
    public uint dwTime;

    /// UINT32->unsigned int
    public uint historyCount;

    /// INT32->int
    public int inputData;

    /// DWORD->unsigned int
    public uint dwKeyStates;

    /// UINT64->unsigned __int64
    public ulong PerformanceCount;

    /// POINTER_BUTTON_CHANGE_TYPE->tagPOINTER_BUTTON_CHANGE_TYPE
    public tagPOINTER_BUTTON_CHANGE_TYPE ButtonChangeType;
}

[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public struct tagPOINTER_TOUCH_INFO {

    /// POINTER_INFO->tagPOINTER_INFO
    public tagPOINTER_INFO pointerInfo;

    /// TOUCH_FLAGS->UINT32->unsigned int
    public uint touchFlags;

    /// TOUCH_MASK->UINT32->unsigned int
    public uint touchMask;

    /// RECT->tagRECT
    public tagRECT rcContact;

    /// RECT->tagRECT
    public tagRECT rcContactRaw;

    /// UINT32->unsigned int
    public uint orientation;

    /// UINT32->unsigned int
    public uint pressure;
}

[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public struct Point {

    /// LONG->int
    public int x;

    /// LONG->int
    public int y;
}

[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public struct tagRECT {

    /// LONG->int
    public int left;

    /// LONG->int
    public int top;

    /// LONG->int
    public int right;

    /// LONG->int
    public int bottom;
}

[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public struct HWND__ {

    /// int
    public int unused;
}

public partial class NativeMethods {

    /// Return Type: BOOL->int
    ///maxCount: UINT32->unsigned int
    ///dwMode: DWORD->unsigned int
    [System.Runtime.InteropServices.DllImportAttribute("user32.dll", EntryPoint="InitializeTouchInjection")]
    [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)]
public static extern  bool InitializeTouchInjection(uint maxCount, uint dwMode) ;


    /// Return Type: BOOL->int
    ///count: UINT32->unsigned int
    ///contacts: POINTER_TOUCH_INFO*
    [System.Runtime.InteropServices.DllImportAttribute("user32.dll", EntryPoint="InjectTouchInput")]
    [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)]
public static extern  bool InjectTouchInput(uint count, ref tagPOINTER_TOUCH_INFO contacts) ;

}