想使用串口模拟出tab的按键操作,先把功能放在button事件里面了,但是点击button之后,焦点只会到tabindex=1的控件上,不会往下走~
[DllImport("Coredll.dll")]
static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, uint dwExtraInfo);
[DllImport("Coredll.dll")]
static extern byte MapVirtualKey(byte wCode, int wMap);
private void exportResult_Click(object sender, EventArgs e)
{
keybd_event(9, MapVirtualKey(9, 0), 0, 0);
keybd_event(9, MapVirtualKey(9, 0), 0x2, 0);
}
------解决方案--------------------
点击button: 由于 Button 有 TAB 属性,点击会改变 TAB 的响应顺序