天天看點

C#WindowsForm滑鼠消息

--Panel--錨定Anchor,BoderStyle--

C#WindowsForm滑鼠消息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication2_Csharp
{
    public partial class Form4 : Form
    {
        public Form4()
        {
            InitializeComponent();
            panel1.MouseWheel += Panel1_MouseWheel;
        }
        private void Panel1_MouseWheel(object sender, MouseEventArgs e)
        {//滾動向上向下
            textBox1.Clear();
            textBox1.Text += "E:Detla "+e.Delta.ToString()+"  " ;
        }
        private void Form4_Load(object sender, EventArgs e)
        {

        }

        private void panel1_MouseDown(object sender, MouseEventArgs e)
        {//點選
            if (e.Button == MouseButtons.Left)
            {
                textBox1.Clear();
                textBox1.Text = "MouseLocation X:" + e.X.ToString() + "                  " + "MouseLocation X:+" + e.Y.ToString();
                textBox1.Text += "      Mousebuttons:LEFT";
            }
           

        }

        private void panel1_MouseHover(object sender, EventArgs e)
        {//懸停
            textBox1.Text += "MouseHover";
        }
    }
}
           
C#WindowsForm滑鼠消息
C#WindowsForm滑鼠消息
C#WindowsForm滑鼠消息
C#WindowsForm滑鼠消息
C#WindowsForm滑鼠消息