/// <summary> /// 初始化Joystick /// </summary> private void JoystickInit() { _joystick_P = new Joystick_P(); _joystick_P.Move += new EventHandler <JoystickEventArgs>(_joystick_P_Click); _joystick_P.Register(this.Handle, API.JOYSTICKID1); _joystick_V = Joystick_V.ReturnJoystick(API.JOYSTICKID1); _joystick_V.Capture(); }
/// <summary> /// 打开服务 /// </summary> public void Open(Control main) { _joystick_P = new Joystick_P(); _joystick_P.Click += new EventHandler <JoystickEventArgs>(_joystick_P_Click); _joystick_P.Register(main.Handle, API.JOYSTICKID1); _joystick_V = Joystick_V.ReturnJoystick(API.JOYSTICKID1); _joystick_V.Capture(); _worker = new BackgroundWorker(); _worker.WorkerSupportsCancellation = true; _worker.DoWork += _worker_DoWork; _worker.RunWorkerAsync(); }