/// <summary> /// 插入列表 /// </summary> /// <param name="dr"></param> /// <param name="img"></param> public void DGVInsert(int userid, string username) { if (DGVGameUser.InvokeRequired) { delegate_DGVInsert d = new delegate_DGVInsert(DGVInsert); object arg0 = userid; object arg1 = username; this.Invoke(d, arg0, arg1); } else { bool isRoleAdd = true; foreach (DataGridViewRow dgvr in DGVGameUser.Rows) { if ((int)dgvr.Cells[0].Value == userid) { isRoleAdd = false; //dgvRoleList.Rows.Remove(dgvr); } } if (isRoleAdd) { DGVGameUser.Rows.Insert(0, userid, username, "移除"); labelUserCount.Text = DGVGameUser.Rows.Count.ToString(); } } }
/// <summary> /// 插入列表 /// </summary> /// <param name="dr"></param> /// <param name="img"></param> private void DGVInsert(DataRow dr, Image img) { if (dgvRoleList.InvokeRequired) { delegate_DGVInsert d = new delegate_DGVInsert(DGVInsert); object arg0 = dr; object arg1 = img; this.Invoke(d, arg0, arg1); } else { dgvRoleList.Rows.Add(dr["F_ID"], dr["F_GRoleName"], img); } }