Os explico el problema.
El componente tiene el método:
Código PHP:
IPictureDisp** ExportPicture(ItemSetConstants ItemSet, short IncludeBackColor, short IncludeBackPick);
Código:
Haciendo pruebas en C++Builder he llegado a esto:Example 1 (VB) ' Export the diagram to a picture box: ' here, we copy only the selected items. Picture1.Picture = AddFlow1.ExportPicture(afSelectedItems, False, False) Example 2 (VB) ' Copy the diagram to the clipboard: ' here we wish to copy all items and the back picture. Clipboard.Clear Clipboard.SetData AddFlow1.ExportPicture(afAllItems, False, True) Example 3 (VB) ' Save the diagram in a file: ' here we don›t want to save the grid. Dim pic As IpictureDisp AddFlow1.ShowGrid = False Set pic = AddFlow1.ExportPicture(afAllItems, True, True) AddFlow1.ShowGrid = True SavePicture pic, "myfile.emf"
Código PHP:
unsigned int DataHandle;
HPALETTE APalette;
unsigned short MyFormat;
TPicture *pic;
_di_IPictureDisp *pIPD = new _di_IPictureDisp;
//ExportPicture devuelve un IPictureDisp** y quiero pasarlo a un _di_IPictureDisp
pIPD->operator =((IPictureDisp*)AddFlow1->ExportPicture((afSelectedItems, true, true));
try
{
pic = new TPicture; //Solicito memoria para el TPicture
__try
{
try
{
SetOlePicture(pic, *pIPD); //Paso la imagen del IPictureDisp al TPicture
//Envio la imagen al portapapeles
pic->SaveToClipboardFormat(MyFormat,DataHandle,APalette);
Clipboard()->SetAsHandle(MyFormat,DataHandle);
}catch(...){
ShowMessage("Fallo al copiar la imagen al portapapeles.");
}
}__finally{
delete pic; //Libero la memoria del TPicture
}
}catch(...){
ShowMessage("No hay memoria suficiente.");
}