遗忘海岸

江湖程序员 -Feiph(LM战士)

导航

按绑定数据设置单元格风格

            gridView1.RowCellStyle += (s, e) => 
            {
               
                

                var data = gridView1.GetRow(e.RowHandle);
                
                var card = data as I_Craft_Card;
                if (!card.DoMLackFlag.HasValue ) return;
                if (card.DoMLackFlag == 0) return;
                if (card != null)
                {
                    if (e.Column.FieldName == "ter1" && (card.DoMLackFlag & 0x00000001) >0 )
                    {
                        e.Appearance.BackColor = Color.Red;

                    }
                    if (e.Column.FieldName == "ter2" && (card.DoMLackFlag & 0x00000002) >0 )
                    {
                        e.Appearance.BackColor = Color.Red;

                    }
                    if (e.Column.FieldName == "length" && (card.DoMLackFlag & 0x00000010) > 0)
                    {
                        e.Appearance.BackColor = Color.Red;

                    }
                }
            };
View Code

 

posted on 2017-09-28 09:11  遗忘海岸  阅读(203)  评论(0编辑  收藏  举报