当前位置:首页 > 开发 > 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# 获取网页源代码

private static string GetHtml(str...

C# 获取屏幕高宽度

方式1-不包含任务栏高度    var primaryScr...

C# BackgroundWorker

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

C# System.IO.Path

System.IO.Path.GetExtension返回指定的路径字符串的扩展名。string&n...

C# ref 和out

ref关键字概念:ref是 C# 中的一个关键字,用于按引用传递参数。当在方法调用中使用ref关键字...

C# Byte[]转为Bitmap

在 C# 中,可以使用System.Drawing命名空间下的相关类将byte[]类型的数据转换为B...