c#winform datagridview隐藏单元格的值

 

c#winform datagridview隐藏单元格的值
 //隐藏单元格的值
        private void dataGridView_front_section_storage_07_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
        {
            if (e.ColumnIndex != dataGridView_front_section_storage_07.Columns["c1"].Index) //"c1" column1的title
            {
                //string description = "something";
                if (e.Value != null)

                {
                    //  if (e.Value.ToString() == description)
                    if (e.Value.ObjToInt() >=1)
                    {
                        e.CellStyle.ForeColor = e.CellStyle.BackColor;
                        e.CellStyle.SelectionForeColor = e.CellStyle.SelectionBackColor;
                    }
                }
            }
        }

 

posted @ 2023-07-18 14:53  txwtech  阅读(217)  评论(1编辑  收藏  举报