private void 压力测试勿随意使用ToolStripMenuItem_Click(object sender, EventArgs e) { TimeSpan a, b, c, d, f, g, h; ClearTable(); MessageBox.Show("现在开始压力测试,期间可能出现卡死现象,请耐心等待。" + "\n若有提示窗口出现请尽可能快的点击以尽可能获得准确结果。"); a = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0); for (int i = 0; i < 255; i++) { Table1.Columns.Add(Table1.Columns.Count.ToString(), Table1.Columns.Count.ToString()); Table1.Rows.Add(); } #region PressureTest Table1.SelectAll(); c = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0); SelectPosition(); d = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0); tableCon.GenerateValue(1, Table1.Rows.Count * Table1.Columns.Count); f = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0); SaveTable(); g = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0); MessageBox.Show("请打开你刚才保存的表"); h = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0); OpenTable(); b = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0); #endregion #region MBox MessageBox.Show(string.Format( "压力测试完成" + "\n共耗时:{0}秒" + "\n其中选择坐标占用{1}秒" + "\n记录坐标占用{2}秒" + "\n生成内容占用{3}秒(包括操作浏览框的时间)" + "\n保存表格占用{4}秒(包括操作浏览框的时间)" + "\n打开表格占用{5}秒" , Convert.ToInt64(b.TotalSeconds - a.TotalSeconds) , Convert.ToInt64(c.TotalSeconds - a.TotalSeconds) , Convert.ToInt64(d.TotalSeconds - c.TotalSeconds) , Convert.ToInt64(f.TotalSeconds - d.TotalSeconds) , Convert.ToInt64(g.TotalSeconds - f.TotalSeconds) , Convert.ToInt64(b.TotalSeconds - h.TotalSeconds))); #endregion }