From Grid 颜色

1、控制行的颜色,重写Grid的displayOption()。

 1 public void displayOption(Common _record, FormRowDisplayOption _options)
 2 {
 3     PushTbBOMConfiguration  config;
 4     ;
 5 
 6     config = _record;
 7     if (config.Color == 'Red')
 8     {
 9         _options.textColor(WinAPI::RGB2int(255,0,0));
10     }
11     super(_record, _options);
12 }

 

2、控制列的颜色。

 1 public void displayOption(Common _record, FormRowDisplayOption _options)
 2 {
 3     PushTbBOMConfiguration  config;
 4     ;
 5 
 6     config = _record;
 7     // PushTbBOMConfiguration_Size02 为表格中的某一个列
 8     PushTbBOMConfiguration_Size02.colorScheme(FormColorScheme::RGB);        
 9     PushTbBOMConfiguration_Size02.foregroundColor(WinAPI::RGB2int(255,0,0));        
10     _options.affectedElementsByField(fieldnum(PushTbBOMConfiguration,size02));
11         
12     super(_record, _options);
13 }

 

3、控制单元格的颜色。

 1 public void displayOption(Common _record, FormRowDisplayOption _options)
 2 {
 3     PushTbBOMConfiguration  config;
 4     ;
 5 
 6     config = _record;
 7     // PushTbBOMConfiguration_Size02 为表格中的某一个列
 8     if (config.Color=='Red')
 9     {
10          _options.affectedElementsByControl(PushTbBOMConfiguration_Size02.id());
11          _options.textColor(WinAPI::RGB2int(255,0,0));
12     }
13     super(_record, _options);
14 }
posted @ 2012-08-27 16:13  Sprite.z  Views(281)  Comments(0Edit  收藏  举报