双击代码如下。读取txt文件中的字符来获取坐标。假如放在按钮中进行响应没有问题,可以双击打开,放在form的构造函数中就只是把鼠标移动到了坐标位置,但是无法做出双击事件
StreamReader reader = new StreamReader(str0 + str_once, System.Text.Encoding.Default);
String str;
int[] px;
px = new int[2];
int i = 0;
while ((str = reader.ReadLine()) != null)
{
Regex reg = new Regex(@"-?[\d]+?[\d]+");
Match mm = reg.Match(str);
MatchCollection mc = reg.Matches(str);
foreach (Match m in mc)
{
px[i] = int.Parse(m.Value.Trim());
i++;
}
}
reader.Close();
SetCursorPos(px[0], px[1]);
System.Threading.Thread.CurrentThread.Join(delay_ms);
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
System.Threading.Thread.CurrentThread.Join(delay_ms);
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);