如何通过鼠标单击/位置来获得窗口/控制手柄? [英] how to get window / control handle by mouse click / pos?

查看:90
本文介绍了如何通过鼠标单击/位置来获得窗口/控制手柄?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过鼠标在桌面上的位置来获取对象句柄.
我该怎么做?

I''m want to get object handle by mouse position in desktop.
How I can do it?

推荐答案

我需要更多信息来回答这个问题,但这是如何获取已被单击的控件的句柄.
I need more information to answer this, but here''s how one would get the handle of a control that has been clicked.
var clickMe = new Panel();
parent.Controls.Add(clickMe);
clickMe.MouseClick += (sender, e) => MessageBox.Show("The control''s handle is " + (sender as Control).Handle);


这篇关于如何通过鼠标单击/位置来获得窗口/控制手柄?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆