// 光标跟踪 void plot_track() { bool pushed = false; try { _hander.Invoke(new Action(() => pushed = _hander._click_cursor.Pushed)); } catch { }; if ((pushed) && (plot_active_sign)) { int width_l = 50; int width_r = 17; double width = (_plot.Width - (width_l + width_r)); //L 46, R123 if (width < 1) { width = 1; } _hander.Invoke(new Action(() => { _plot.DataCursors.Channels[0].PositionX = (_plot.PointToClient(Control.MousePosition).X - width_l) / width; })); } }
void mode_init() { _lost_focus = new Panel(); _hander.Invoke(new Action(() => { _hander.Controls.Add(_lost_focus); })); _serialPort = new SerialPort(); //串口解析任务 Thread th = new Thread(parse_task) { Priority = ThreadPriority.Highest, IsBackground = true }; th.Start(); //串口刷新任务 Thread th1 = new Thread(port_refresh_task) { Priority = ThreadPriority.BelowNormal, IsBackground = true }; th1.Start(); }