Ver Mensaje Individual
  #6 (permalink)  
Antiguo 02/01/2008, 18:16
Avatar de Peterpay
Peterpay
Colaborador
 
Fecha de Ingreso: septiembre-2007
Ubicación: San Francisco, United States
Mensajes: 3.858
Antigüedad: 17 años, 6 meses
Puntos: 87
Re: como saber sobre que control pasa el mouse

Se me ocurre algo asi

public partial class Form1 : Form
{
Timer myTimer;
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
myTimer = new Timer();
myTimer.Interval = 1000;
myTimer.Tick += new EventHandler(myTimer_Tick);
myTimer.Start();
}

void myTimer_Tick(object sender, EventArgs e)
{
Point x=new Point();
if (MouseControl.GetCursorPos(ref x)>0)
{
try
{
MessageBox.Show(this.GetChildAtPoint(x).GetType(). ToString());
}
catch (Exception ex)
{

}
}

}
}

public class MouseControl
{
[DllImport("user32")]
public static extern int GetCursorPos(ref Point lpPoint);
}

lo ineficiente es el timer.