private bool dgvStatItemRefersh() { dgvStatItem.Rows.Clear(); //获取数据 String strSql = String.Format("select * from TD_ActionType where F_DisciplineID = {0} order by F_Order", Common.g_nDiscID); DataTable dataTbl = Common.dbGetTableRecord(strSql); if (dataTbl == null) { return(false); } //填入数据 for (int nRow = 0; nRow < dataTbl.Rows.Count; nRow++) //每行三个 { Int32 nDgvRow = nRow / 3; Int32 nDgvCol = nRow % 3; if (nDgvCol == 0) { dgvStatItem.Rows.Add(); dgvStatItem.Rows[nDgvRow].Height = 18; } dgvStatItem[nDgvCol, nDgvRow].Tag = dataTbl.Rows[nRow]["F_ActionCode"].ToString(); dgvStatItem[nDgvCol, nDgvRow].Value = dataTbl.Rows[nRow]["F_ActionCode"].ToString(); } return(true); }