/// <summary> /// 显示第二个,第三个datagridview的相应信息 /// </summary> public void showMessageDia() { AddNum addnum = new AddNum(); if (dataGridView1.Rows.Count == 0) { printfagain.Enabled = false; Downbutton2.Enabled = false; UPbutton3.Enabled = false; label14.Text = "共有0条记录"; dataGridView2.DataSource = null; dataGridView3.DataSource = null; } else { for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (this.dataGridView1.Rows[i].Cells["status_id"].Value.ToString() == "3") { this.dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Red; } else if (this.dataGridView1.Rows[i].Cells["MEAL_KIND"].Value.ToString() == "1") { this.dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Blue; } else if (this.dataGridView1.Rows[i].Cells["MEAL_KIND"].Value.ToString() == "2") { this.dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Yellow; } } Downbutton2.Enabled = true; UPbutton3.Enabled = true; sale_id = dataGridView1.CurrentRow.Cells["销售单编号"].Value.ToString(); dataGridView2.DataSource = addnum.AddSeriNum(seeAboutSale.payDetail(sale_id)); //隐藏不别要行 AllowViewDataGridView2(); for (int i = 0; i < dataGridView2.Rows.Count; i++) { if (dataGridView2.Rows[i].Cells["状态"].Value.ToString() == "3") { dataGridView2.Rows[i].DefaultCellStyle.BackColor = Color.Red; } } dataGridView2.Columns[0].Width = (int)dataGridView2.Size.Width * 2 / 21; dataGridView2.Columns[1].Width = (int)dataGridView2.Size.Width * 6 / 21; dataGridView2.Columns[2].Width = (int)dataGridView2.Size.Width * 3 / 21; dataGridView2.Columns[3].Width = (int)dataGridView2.Size.Width * 3 / 21; dataGridView2.Columns[4].Width = (int)dataGridView2.Size.Width * 1 / 21; dataGridView2.Columns[5].Width = (int)dataGridView2.Size.Width * 3 / 21; dataGridView2.Columns[6].Width = (int)dataGridView2.Size.Width * 3 / 21; label14.Text = "共有" + dataGridView2.Rows.Count.ToString() + "条记录"; dataGridView3.DataSource = seeAboutSale.payWays(sale_id); dataGridView3.Columns[0].Width = (int)dataGridView3.Size.Width / 2; dataGridView3.Columns[1].Width = (int)dataGridView3.Size.Width / 2; } }