private void btn_QueryAllDatByTime_Click(object sender, EventArgs e) { m_bQueryAllDatByDate = true; m_bQueryAllDatByID = false; dgvCollectDatInfo.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None; //开启了 AutoSizecolumnsMode后DataGirdView会对所有数据进行遍历以决定每一列的宽度,所以绑定速度会受到极大的影响 dgvCollectDatInfo.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None; dgvCollectDatInfo.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing; dgvCollectDatInfo.VirtualMode = true; dgvCollectDatInfo.DataSource = DBOperate_Obj.Query_Collect_Dat("日期", null, dtPickerAll_Begin.Value, dtPickerAll_End.Value, ref zessiMeaDatReadFromDB); //DBOperate_Obj.GetAllDataThroughDate(dtPickerAll_Begin.Value, dtPickerAll_End.Value); Thread.Sleep(500); // 固定前5项 dgvCollectDatInfo.Columns[0].Frozen = true; // 工件类型 dgvCollectDatInfo.Columns[1].Frozen = true; // dgvCollectDatInfo.Columns[2].Frozen = true; dgvCollectDatInfo.Columns[3].Frozen = true; // dgvCollectDatInfo.Columns[4].Frozen = true; // 检查转到dgv中的数据是否有error项,有的话就标红 Detect_AllDatError(dgvCollectDatInfo); }