//结束按钮 private void endIt_Click(object sender, EventArgs e) { //保存Series数据 StaticPatient.SaveSeriesData(new List <Series>() { series1, series2, series3 }); //暂存 StaticPatient.SaveTempData(); //保存进资料库 StaticPatient.SaveToDataBase(); }
//timer事件 private void t_Tick(object sender, EventArgs e) { if (flag) { flag = false; chart.Series[0].Points.Clear(); chart.ChartAreas[0].AxisX.LabelStyle.Enabled = true; } string timeString = time.ToString("HH:mm:ss"); range = r.Next(140, 200); //随机取数 range1 = r1.Next(90, 120); range2 = r2.Next(60, 100); series1.Points.AddXY(timeString, range); //设置series点 series2.Points.AddXY(timeString, range1); series3.Points.AddXY(timeString, range2); //判断timer动了几次 if ((sum - 1) % 5 == 0) { if (sum != 1) { this.medicineData.Columns.Add("", (sum - 1) / 5 + ""); } drawMedicineData(); } time = time.AddSeconds(5); sum++; StaticPatient.SaveSeriesData(new List <Series>() { series1, series2, series3 }); if (sum <= chart.ChartAreas[0].AxisX.ScaleView.Size) { chart.ChartAreas[0].AxisX.ScaleView.Position = 0; } //记得优化多一格的问题 else if (!stop_flag) { chart.ChartAreas[0].AxisX.ScaleView.Size = (int)(((x / l * 20) + 30 * ( 1 + trackBar1.Value / 20.0)) / 5) * 5; if ((sum) % 5 != 0) { chart.ChartAreas[0].AxisX.ScaleView.Position = sum - chart.ChartAreas[0].AxisX.ScaleView.Size + 5 - sum % 5; } else { chart.ChartAreas[0].AxisX.ScaleView.Position = sum - chart.ChartAreas[0].AxisX.ScaleView.Size; } } }
private void mainView_Load(object sender, EventArgs e) { SetButtomsInvalid(); this.MaximumSize = new Size(this.Width, this.Height); x = this.Size.Width - this.MinimumSize.Width; l = this.MaximumSize.Width - this.MinimumSize.Width; LoadAnesthessiaData(); CreateChart(); //CreateMedicineChart(); createSeries(); createViewList(); BasicDataShow(); //medicineLst_init(); t.Start(); StaticPatient.TimerStart(); SetButtomsValid(); }