这是一个片段:
Point mouseLocation;
public Form1( )
{
InitializeComponent();
this.MouseMove += new MouseEventHandler(Form1_MouseMove);
}
void Form1_MouseMove(object sender , MouseEventArgs e)
{
mouseLocation = e.Location;
}
Run Code Online (Sandbox Code Playgroud)
@AdriannStander为研究提供了3个优秀的链接 - 我只是喜欢编写代码片段;)