2012年10月29日星期一

How to convert measurement from Char to MM on dyamics ax report




ReportControl 默认是100mm计量,传入参数Char2100mm(12)得到12 char的100mm长度值

reportControl.left100mm(Char2100mm(12,WidthHeight::Width));
reportControl.width100mm(Char2100mm(15,WidthHeight::Width));
reportControl.top100mm(Char2100mm(12,WidthHeight::Height));
reportControl.height100mm(Char2100mm(2,WidthHeight::Height));

所以增加以下方法可以用来计算Char和MM单位转换后的值。

public static real THK_Char2100mm(real          _measurement,
                                  WidthHeight   _WidthHeight)
{
    real    convertedMeasurement;
;
    if (_measurement)
    {
        switch (_WidthHeight)
        {
            case WidthHeight::Width :
                convertedMeasurement = _measurement *   161;
                break;

            case WidthHeight::Height :
                convertedMeasurement = _measurement *   361;
                break;
        }
    }
    else
    {
        convertedMeasurement = _measurement;
    }
    return convertedMeasurement;
}

没有评论:

发表评论