Axapta Microsoft dynamics AX 2009网格着色问题

Axapta Microsoft dynamics AX 2009网格着色问题,axapta,microsoft-dynamics,dynamics-ax-2009,Axapta,Microsoft Dynamics,Dynamics Ax 2009,所以我试着用不同的颜色给线条上色。如果我在一行中选中current.PrimaryTransportation复选框,我得到的只是一个大的黄色网格 我使用的代码如下所示: public void displayOption(Common _record, FormRowDisplayOption _options) { SIS_ResourcesTmp buffer = _record; SIS_ResourceSum current = SIS_R

所以我试着用不同的颜色给线条上色。如果我在一行中选中current.PrimaryTransportation复选框,我得到的只是一个大的黄色网格

我使用的代码如下所示:

public void displayOption(Common _record, FormRowDisplayOption _options)
{
    SIS_ResourcesTmp        buffer = _record;
    SIS_ResourceSum         current = SIS_ResourceSum_DS.cursor();

    #define.grey(12895428)
    #define.white(16448250)
    #define.yellow(3927039)
    ;

    _options.backColor(#grey);

    if (!current.VendorPrice && !current.UnitConvertRate) {
        if (!current.UnitConvertToTons && !current.DistanceVendorToObject && current.PrimaryTransportation) {
            _options.backColor(#yellow);
        }
    } else {
       _options.backColor(#white);
    }

    SIS_ResourcesTmp_ds.refresh();
}
if (!current.VendPrice && 
    !current.UnitConvertRate && 
    !current.UnitConvertToTons &&
    current.PrimaryTransportation)
{
    _options.backColor(#yellow);
}
else
{
    _options.backColor(#white);
}

使用参数
\u record
检查是否将当前行的颜色设置为黄色。

这取决于您的场景,但我认为嵌套的if语句还需要一个其他条件。或者我宁愿尝试消除嵌套的,如果是这样的:

public void displayOption(Common _record, FormRowDisplayOption _options)
{
    SIS_ResourcesTmp        buffer = _record;
    SIS_ResourceSum         current = SIS_ResourceSum_DS.cursor();

    #define.grey(12895428)
    #define.white(16448250)
    #define.yellow(3927039)
    ;

    _options.backColor(#grey);

    if (!current.VendorPrice && !current.UnitConvertRate) {
        if (!current.UnitConvertToTons && !current.DistanceVendorToObject && current.PrimaryTransportation) {
            _options.backColor(#yellow);
        }
    } else {
       _options.backColor(#white);
    }

    SIS_ResourcesTmp_ds.refresh();
}
if (!current.VendPrice && 
    !current.UnitConvertRate && 
    !current.UnitConvertToTons &&
    current.PrimaryTransportation)
{
    _options.backColor(#yellow);
}
else
{
    _options.backColor(#white);
}

AX支持使用十六进制文字,因此请使用0xC4C4而不是12895428。颜色是GBR编码的。