setControl

 public static void setControl(ReportShapeControl _shape,ReportBitmapControl _bitmap,ItemId _itemId,BomId _bomId = "")
{
    ItemId              curItemId;
    BomId               curBomId;
    InventBatch         curInventBatch;
    FilenameOpen        filename;
    Image               goodsImage = new image();
    EajZoomBitmap       zoomBitmap;
    int                 w,h;
    real                oldLeftValue,newLeftValue;
    real                oldTopValue,newTopValue;
    ;

    //curItemId       = InventBatch::findItemId(_inventBatchId);
    //curInventBatch  = InventBatch::find(_inventBatchId,curItemId);
    //curBomId        = curInventBatch.BOMId ;

    filename = EajPublic::EajGetPicFilename(_ItemId,_bomId);
    if (WinAPI::fileExists(filename))
    {
        goodsImage.loadImage(filename);
        W = goodsImage.width() ;
        H = goodsImage.height();
        _bitmap.resizeBitmap(true);
        zoomBitmap = new EajZoomBitmap(_shape.widthValue(),_shape.heightValue(),w,h);
        zoomBitmap.resize();

        oldLeftValue    = _shape.leftValue();
        newLeftValue    = oldLeftValue + _shape.widthValue()/2 - zoomBitmap.width()/2;
        oldTopValue     = _shape.topValue();
        newTopValue     = oldTopValue + _shape.heightValue()/2 - zoomBitmap.height()/2;
        _bitmap.top(newTopValue,Units::mm);
        _bitmap.left(newLeftValue,Units::mm);

        _bitmap.width(zoomBitmap.width(),units::mm);
        _bitmap.height(zoomBitmap.height(),units::mm);
    }


}
posted @ 2012-06-22 14:18  perock  阅读(491)  评论(0编辑  收藏  举报