using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using System.Runtime.InteropServices;

namespace Ex07_5
{
    public partial class Form1 : Form
    {

        [DllImport("user32.dll", EntryPoint = "SwapMouseButton")]
        public static extern int SwapMouseButton(int bSwap);
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Cursor.Hide();  //隐藏鼠标
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Cursor.Show();  //显示鼠标
        }

        private void button3_Click(object sender, EventArgs e)
        {
            SwapMouseButton(1);    //鼠标左右键交换
        }

        private void button4_Click(object sender, EventArgs e)
        {
            SwapMouseButton(0);    //恢复鼠标默认设置
        }
    }
}
