阅读背景:

Flex设置DataGrid单元格颜色以及表头背景颜色渐变

来源:互联网 

1、 设置DataGrid单元格颜色

package com.tjsoft.base.common.page
{
	import flash.display.Sprite;
	import mx.controls.DataGrid;
	public class ColorsDataGrid extends DataGrid
	{
		public function ColorsDataGrid()
		{
			super();
		}
		/**
		 * 
		 * 设置单元格背景颜色
		 * 
		 * */
		override protected function drawRowBackground(s:Sprite, rowIndex:int, y:Number, height:Number, color:uint, dataIndex:int):void
		{
			if(rowIndex%2==1)
			{
				color=0xffffff;	//偶数行
			}else{
				color=0xefefef;	//奇数行
	}			 super.drawRowBackground(s,rowIndex,y,height,color,dataIndex);
		}
	}
}
package com.tjsoft.base



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: