ToucDownBtn.cs 1.1 KB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Permissions;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

class ToucDownBtn : System.Windows.Forms.Button
{

    public const int WM_POINTERDOWN = 0x246;
    public const int WM_POINTERUP = 0x247;

    [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
    protected override void WndProc(ref Message m)
    {
        switch (m.Msg)
        {
            case WM_POINTERDOWN:
                {
                    MouseEventArgs args = new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0);
                    OnMouseDown(args);
                    //Console.WriteLine("WM_POINTERDOWN");
                    break;
                }

            case WM_POINTERUP:
                {
                    MouseEventArgs args = new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0);
                    OnMouseUp(args);
                    //Console.WriteLine("WM_POINTERUP");
                    break;
                }
        }
        base.WndProc(ref m);
    }
}