protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (!canOpen) { return(false); } switch (keyData) { case Keys.Left: AngleBox.Focus(); LeftButton_MouseDown(null, null); break; case Keys.Right: AngleBox.Focus(); RightButton_MouseDown(null, null); break; case Keys.B: BrakeButton_Click(null, null); break; case Keys.R: ReleaseButton_Click(null, null); break; } return(base.ProcessCmdKey(ref msg, keyData)); }
private void RightButton_MouseDown(object sender, MouseEventArgs e) //右键 { if (Angle + AngleStep <= MaxAngle) { Angle += AngleStep; } else { Angle = MaxAngle; } if (AngleCanCheck.Checked) { Send(Angle, SendType.AnlgeCan); } else { Send(Angle, SendType.Angle); } RightButton.Image = global::CarTest.Properties.Resources.youi; AngleBox.Focus(); }
private void LeftButton_MouseDown(object sender, MouseEventArgs e) //左键 { if (Angle - AngleStep >= -MaxAngle) { Angle -= AngleStep; } else { Angle = -MaxAngle; } if (AngleCanCheck.Checked) { Send(Angle, SendType.AnlgeCan); } else { Send(Angle, SendType.Angle); } LeftButton.Image = global::CarTest.Properties.Resources.zuoi; AngleBox.Focus(); }