找回密码
 立即注册

QQ登录

只需一步,快速开始

merciful

论坛元老

18

主题

46

帖子

4982

积分

论坛元老

积分
4982

活字格认证

merciful
论坛元老   /  发表于:2011-8-26 12:55  /   查看:5996  /  回复:3
一行40几项,根据条件每行的字体颜色不同,现在我有9万多条数据,显示的时候非常慢,而且经常出现内存溢出错误。
现在字体颜色的设置方法是每个cell设置字体颜色。
请问是否有效率更高的方法,谢谢!

if (Convert.ToBoolean(drv["DeleteFlag"]))
                {
                    for (int i = 0; i < this.gcAreaGrid.ColumnHeaders[0].Cells.Count; i++)
                    {
                        this.gcAreaGrid.Rows[rowIndex].Style.ForeColor = Color.Gray;  -- 内存溢出
                    }
                }
                else
                {
                    for (int i = 0; i < this.gcAreaGrid.ColumnHeaders[0].Cells.Count; i++)
                    {
                        this.gcAreaGrid.Rows[rowIndex].Style.ForeColor = Color.Black;  -- 内存溢出

                    }
                }

3 个回复

倒序浏览
chenf1980
论坛元老   /  发表于:2011-8-26 13:26:00
沙发
在cellformating事件里设置下看看呢
e.style.forecolor = color.black
回复 使用道具 举报
robert
金牌服务用户   /  发表于:2011-8-26 18:37:00
板凳
楼上正解
回复 使用道具 举报
merciful
论坛元老   /  发表于:2011-8-29 12:27:00
地板

回复 2# chenf1980 的帖子

thank u
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部