在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
#region MyRegion DataGridViewTextBoxColumn col = new DataGridViewTextBoxColumn(); DataGridViewTextBoxColumn col1 = new DataGridViewTextBoxColumn(); DataGridViewTextBoxColumn col2 = new DataGridViewTextBoxColumn(); DataGridViewTextBoxColumn col3 = new DataGridViewTextBoxColumn(); DataGridViewTextBoxColumn col4 = new DataGridViewTextBoxColumn(); DataGridViewImageColumn col5 = new DataGridViewImageColumn(); DataGridViewTextBoxCell celltext = new DataGridViewTextBoxCell(); DataGridViewImageCell cellimage = new DataGridViewImageCell(); col.CellTemplate = col1.CellTemplate = col2.CellTemplate = col3.CellTemplate = col4.CellTemplate = celltext; col5.CellTemplate = cellimage; col.HeaderText = "名称"; col1.HeaderText = "分类"; col2.HeaderText = "数量"; col3.HeaderText = "价格"; col4.HeaderText = "销售时间"; col5.HeaderText = "图片"; dataGridView1.Columns.Add(col); dataGridView1.Columns.Add(col1); dataGridView1.Columns.Add(col2); dataGridView1.Columns.Add(col3); dataGridView1.Columns.Add(col4); dataGridView1.Columns.Add(col5); //-- DataGridViewRow row = new DataGridViewRow(); int index = dataGridView1.Rows.Add(row); dataGridView1.Rows[index].Cells[0].Value = "0001"; dataGridView1.Rows[index].Cells[1].Value = "0002"; dataGridView1.Rows[index].Cells[2].Value = "0003"; dataGridView1.Rows[index].Cells[3].Value = "0004"; dataGridView1.Rows[index].Cells[4].Value = "0005"; // dataGridView1.Rows[index].Cells[5].Value = "";// Image.FromFile(); #endregion
this.dataGridView1.Columns.Add("0","001");//添加列
DataTable dt = (DataTable)dataGridView1.DataSource; |
请发表评论