通过Graphics对象获取它所属的Control
using System.Runtime.InteropServices;
[DllImport("user32.dll")]
public static extern IntPtr WindowFromDC(IntPtr hDC);
private void button1_Click(object sender, EventArgs e)
{
Graphics vGraphics = Graphics.FromHwnd(Handle);
Control vControl = Control.FromHandle(WindowFromDC(vGraphics.GetHdc()));
if (vControl != null) MessageBox.Show(vControl.Name);
}
http://blog.csdn.net/zswang/article/details/1587875