首页 > 技术文章 > T100——改变字体、行、列的显示颜色

xiaoli9627 2019-09-20 14:53 原文

 

 比如像这样,把有差异的字段颜色标红显示;

1,定义一个DYNAMIC ARRAY OF RECORD来存放字段的颜色配置(字段均为string类型),

比如DEFINE g_imaf_d_color   DYNAMIC ARRAY OF RECORD;字段一一对应g_imaf_d的字段;

2,设置LET g_imaf_d_color[l_ac].xxxx= 'red' ;

3,在BEFORE DIALOG或BEFORE DISPLAY下(反正是在填充完显示前)CALL DIALOG.setCellAttributes(g_imaf_d_color);

4,OK。

=====================================================================

另外,CALL cl_set_comp_font_color("oea01,oea04", "red") 这个函数可设置整列的字体颜色;

顏色種類有:BLACK,BLUE,CYAN,GREEN,MAGENTA,RED,WHITE,YELLOW.;

可以設定顏色的元件有EDIT,BUTTONEDIT,COMBOBOX,DATEEDIT,LABEL. 

 

 

 

======================================================================

改变整行的背景色:

 

 

1,首先定义一个DYNAMIC ARRAY OF RECORD,对应多少列,如共13列内容即c01-c13;

DEFINE g_xccc_d_color   DYNAMIC ARRAY OF RECORD
                           c01   STRING,
                           c02   STRING,
                           c03   STRING,
                           c04   STRING,
                           c05   STRING,
                           c06   STRING,
                           c07   STRING,
                           c08   STRING,
                           c09   STRING,
                           c10   STRING,
                           c11   STRING,
                           c12   STRING,
                           c13   STRING
                        END RECORD

 

 

2,对指定的行进行“染色”

            #add-point:ui_dialog段before dialog
#插完栏位,对第1,22,34行设定蓝色底色
               LET g_current_page = 1
               LET g_xccc_d_color[1].c01 = 'blue reverse'
               LET g_xccc_d_color[1].c02 = 'blue reverse'
               LET g_xccc_d_color[1].c03 = 'blue reverse'
               LET g_xccc_d_color[1].c04 = 'blue reverse'
               LET g_xccc_d_color[1].c05 = 'blue reverse'
               LET g_xccc_d_color[1].c06 = 'blue reverse'
               LET g_xccc_d_color[1].c07 = 'blue reverse'
               LET g_xccc_d_color[1].c08 = 'blue reverse'
               LET g_xccc_d_color[1].c09 = 'blue reverse'
               LET g_xccc_d_color[1].c10 = 'blue reverse'
               LET g_xccc_d_color[1].c11 = 'blue reverse'
               LET g_xccc_d_color[1].c12 = 'blue reverse'
               LET g_xccc_d_color[1].c13 = 'blue reverse'
               LET g_xccc_d_color[22].c01 = 'blue reverse'
               LET g_xccc_d_color[22].c02 = 'blue reverse'
               LET g_xccc_d_color[22].c03 = 'blue reverse'
               LET g_xccc_d_color[22].c04 = 'blue reverse'
               LET g_xccc_d_color[22].c05 = 'blue reverse'
               LET g_xccc_d_color[22].c06 = 'blue reverse'
               LET g_xccc_d_color[22].c07 = 'blue reverse'
               LET g_xccc_d_color[22].c08 = 'blue reverse'
               LET g_xccc_d_color[22].c09 = 'blue reverse'
               LET g_xccc_d_color[22].c10 = 'blue reverse'
               LET g_xccc_d_color[22].c11 = 'blue reverse'
               LET g_xccc_d_color[22].c12 = 'blue reverse'
               LET g_xccc_d_color[22].c13 = 'blue reverse'
               LET g_xccc_d_color[34].c01 = 'blue reverse'
               LET g_xccc_d_color[34].c02 = 'blue reverse'
               LET g_xccc_d_color[34].c03 = 'blue reverse'
               LET g_xccc_d_color[34].c04 = 'blue reverse'
               LET g_xccc_d_color[34].c05 = 'blue reverse'
               LET g_xccc_d_color[34].c06 = 'blue reverse'
               LET g_xccc_d_color[34].c07 = 'blue reverse'
               LET g_xccc_d_color[34].c08 = 'blue reverse'
               LET g_xccc_d_color[34].c09 = 'blue reverse'
               LET g_xccc_d_color[34].c10 = 'blue reverse'
               LET g_xccc_d_color[34].c11 = 'blue reverse'
               LET g_xccc_d_color[34].c12 = 'blue reverse'
               LET g_xccc_d_color[34].c13 = 'blue reverse'            
               CALL DIALOG.setArrayAttributes("s_detail1",g_xccc_d_color)
            #end add-point

 

推荐阅读