如果我单击调用所有工具条菜单,则仅显示这四种形式(我的形式:汽车检索、钥匙定位、检索警报、汽车交付确认)。我一键将这四种形式组合在一起。
代码是这样的:
private void InvloveAllToolStripMenuItem_Click(System.Object sender, System.EventArgs e)
{
this.KeyUp += HandleKeyPress; frmKeyAssignBoard frm = new frmKeyAssignBoard();
frm.Location = new Point(625, 0); frm.MdiParent = this; frm.KeyUp += HandleKeyPress; frm.Show(); FrmrecievedDelivaryRequest frm1 = new FrmrecievedDelivaryRequest();
frm1.Location = new Point(625, 225);
frm1.MdiParent = this;
frm.KeyUp += HandleKeyPress;
frm1.Show();
FrmDelivary frm2 = new FrmDelivary();
frm2.Location = new Point(965, 0);
frm2.MdiParent = this;
frm.KeyUp += HandleKeyPress;
frm2.Show();
frmCarCall frm3 = new frmCarCall();
frm3.Location = new Point(0, 0);
frm3.MdiParent = this;
frm.KeyUp += HandleKeyPress;
frm3.Show();
}
实际上这些表格是我的主表格的子表格。我想以这些形式使用功能键。
我的意思是,如果我单击“k”应该将光标定位到键定位表单 - carid 文本框,如果我单击“D”应该将光标定位到检索警报 - 驱动程序 ID gridview 行,如果我单击“R”,那么它应该定位光标到汽车检索 - 汽车 ID 文本框。我怎样才能做到这一点?
我尝试在我的主键按下事件中编写您的代码,如下所示: Private Sub frmMaster_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown If e.KeyCode = Keys.A Then Dim form As New FrmDelivary form.Show() form.txtTicket.Focus() Cursor.Position = form.txtTicket.Location End If End Sub 如果我点击 A 没有任何反应