111,077
社区成员




private void ctl_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Control ctl = (Control)sender;
int x = ctl.Left + e.X;
int y = ctl.Top + e.Y;
foreach (Control c in ctl.Parent.Controls)
{
if (x > c.Left && x < c.Left + c.Width &&
y > c.Top && y < c.Top + c.Height)
c.BackColor = Color.Red;
else
c.BackColor = SystemColors.Control;
}
}
}
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
private static extern int mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
public static void IsMove_MouseDown(object sender, MouseEventArgs e)
{
Control pL = (Control)sender;
..................................
.................................
if (!current)
{
current = true;
................................
mouse_event(0x0002 | 0x0004, Cursor.Position.X, Cursor.Position.Y, 0, 0);
}
public static void IsMove_MouseMove(object sender, MouseEventArgs e)
{
Control pL = (Control)sender;
if (current)
{
.................................................
}
}
this.click+=function;
private void function(objcet obj,eventargs e){
this.onmouseover();
}
手打的。可能不对,思路应该是这样。