当前位置:首页 > 开发 > C# > 正文内容

C# 控件判断鼠标位置

C#1年前 (2024-12-30)
        /// <summary>
        /// 鼠标抬起事件
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);
            Point mouseLocation = this.PointToClient(Cursor.Position);
            if (this.ClientRectangle.Contains(mouseLocation))
            {
                //鼠标在控件区域上
            }
        }


转载请注明出处。

本文链接:http://www.pythonopen.com/?id=1644

相关文章

C# CRC32算法

CRC32      class CRC32...

C# NPOI

使用NPOI操作.xlsx以及其他格式的文档,并且无需安装OFFICE。实测无法加载带有密码的.xl...

C# MDI例子

父窗口属性IsMdiContainer设置为Trueprivate void b...

C# 缩减代码量的一些方式

static void Main() { Thread thre...

C# BackgroundWorker

1.概述BackgroundWorker是一个在 WinForms 应用程序中用于简化在后台线程执行...

C# double转为string并保留两位小数

在 C# 中,可以使用多种方式将 double 类型的数据转换为 string 类型并保留两位小数,...