zoukankan      html  css  js  c++  java
  • C#中鼠标滚轮的应用

    namespace Mous
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
                ((Control)this).MouseWheel += new MouseEventHandler(Form1_MouseWheel);

            }

            private void textBox1_TextChanged(object sender, EventArgs e)
            {

            }
            void Form1_MouseWheel(object sender, MouseEventArgs e)
            {
                try
                {
                    int i = Convert.ToInt32(textBox1.Text);
                    if (textBox1.Bounds.Contains(e.Location)) //判断鼠标所在的地方是否在控件上
                    {
                        if (e.Delta.ToString() == "120")
                        {
                            i++;
                            textBox1.Text = i.ToString();
                        }
                        else
                        {
                            i--;
                            textBox1.Text = i.ToString();
                        }
                    }
                }
                catch { }
            }

        }
    }

  • 相关阅读:
    (数据结构)十分钟搞定时间复杂度(算法的时间复杂度)
    深入学习二叉树
    我对工作的认识
    mysql系列纠错;
    关于普通指针转换为智能指针的一些问题
    vscode The VS Code Server failed to start
    git 分支管理
    git change_id的理解
    git 指令速查
    c++ make_shared()函数理解 (待整理)
  • 原文地址:https://www.cnblogs.com/whitetiger/p/813992.html
Copyright © 2011-2022 走看看