Display Images on the report
add one display images control of Bitmap,but must be write display method oh.
remark by Jimmy July 2th 2010
show ItemPicture method
void showItemPicture(InventstdPic _InventstdPic)
{
Image Image = new Image();
BinData BinData = new BinData();
container PicCon;
real PicRate;
filePath filePath;
int height,width,FixLen;
name labelStr;
#WinAPI
;
FixLen = 200;
filePath = WinAPI::getFolderPath(#CSIDL_INTERNET_CACHE);
filePath = _InventstdPic.Filename(filePath);
PicCon = _InventStdPic.Images;
Image.setData(PicCon);
height = Image.height();
width = Image.width();
BinData.setData(PicCon);
BinData.saveFile(filePath);
if (height > FixLen || width > FixLen)
{
if (height > width)
PicRate = FixLen / height;
else
PicRate = FixLen / width;
}
ItemImage.width( width * PicRate, Units::mm);
ItemImage.height(height * PicRate, Units::mm);
if(_InventStdPic.ConfigId)
labelStr = _InventStdPic.ItemId + " (" + _InventStdPic.ConfigId + ")";
else
labelStr = _InventStdPic.ItemId;
ItemImage.label(labelStr);
//ItemImage.showPicAsText(Noyes::Yes);
ItemImage.showLabel(Noyes::Yes);
ItemImage.imageName(filePath);
}
ItemImage method used to dispaly current the Images.
display bitMap ItemImage()
{
bitMap bitMap;
;
// bitMap = InventStdPic.Images;
return bitMap;
}
other
void ShowImages(InventStdPic _InventStdPic)
{
Image Image;
BinData BinData;
container Con;
real rates,width,height;
int fix;
filename _filename;
filePath filePath;
#WINAPI
Filename Filename(FilePath path = '')
{
Filename FilenamePath;
;
if (!_InventStdPic.PicsName)
return '';
FilenamePath = strfmt("%1%2%3",(strscan(path, '\\',strlen(path),-1)) ? path : path + '\\',
_InventStdPic.PicsName,
_InventStdPic.PicsExtension);
return FilenamePath;
}
;
fix =50;
Images.showLabel(false);
if(_InventStdPic.ImageSize)
{
if(_InventStdPic.ImageSize > 4)
Images.showLabel(true);
else
{
Con = _InventStdPic.Images;
Image = new Image();
Image.setData(Con);
//get and setup the Bitmap control of width and height
width = Image.width();
height = Image.height();
if (width > fix || height > fix)
{
if (height > width)
rates = fix / height;
else
rates = fix / width;
}
width = width * rates;
height = height * rates;
Images.width(width,Units::mm);
Images.height(height,Units::mm);
//the images container transfer to file path
BinData = new BinData();
BinData.setData(Con);
filePath = WinAPI::getFolderPath(#CSIDL_INTERNET_CACHE);
filePath = Filename(filePath);
BinData.saveFile(filePath);
//put the field path into the Bitmap control
Images.imageName(filePath);
}
}
}

浙公网安备 33010602011771号