当前位置:首页 > 开发 > 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# for,while,do while,switch

for    #region for for ...

C# ArrayList

添加的成员可以是任意类型    ArrayList arra...

C# 请确保您的 Main 函数带有 STAThreadAttribute 标记。”

System.Threading.ThreadStateException:“在可以调用 OLE 之...

C# BackgroundWorker

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

C# [OnPaint]和[OnPaintBackground]的区别

OnPaint和OnPaintBackground的主要功能区别OnPaint:OnPaint方法主...

C# BackgroundWorker,在DoWork里更新控件内容

一般情况下不可以直接在BackgroundWorker的DoWork事件中更新 UI 控件在Back...