DataGrid 表头标题,表格文字的字体设置

主文件中导入包:

import fl.controls.listClasses.CellRenderer;
import fl.data.DataProvider;
import fl.controls.dataGridClasses.DataGridColumn;

DG.setStyle("headerRenderer", DatagridHeaderStyle);
DG.setStyle("cellRenderer", DatagridCellStyle);

 DatagridHeaderStyle.as

package {
	
 import fl.controls.dataGridClasses.HeaderRenderer;
 import flash.text.TextFormat;

 public class DatagridHeaderStyle extends HeaderRenderer {

  public function DatagridHeaderStyle():void {
   super();
  }

 override protected function drawBackground():void {
   var format:TextFormat = new TextFormat();
   format.font = "Arial";//字体为宋体
   format.bold = true;//加粗
   format.size = 12;//大小为12
   format.color = 0x333333;//颜色
   setStyle("textFormat",format);
   super.drawBackground();
  }
 }
}

 

 DatagridCellStyle.as

package {
 import fl.controls.listClasses.CellRenderer;
 import fl.controls.listClasses.ICellRenderer;
 import flash.text.TextFormat;

 public class DatagridCellStyle extends CellRenderer implements ICellRenderer {

  public function DatagridCellStyle():void {
   super();
  }

  override protected function drawBackground():void {
   var format:TextFormat = new TextFormat();
   format.font = "Arial";
   format.size = 12;
   format.color = 0x333333;
   setStyle("textFormat",format);
   super.drawBackground();
  }
 }
}

 

你可能感兴趣的:(datagrid)