Way to Store and Retrive Metafile Info
-
TMetafile *pMetafile = new TMetafile; TMetafileCanvas *pCanvas = new TMetafileCanvas(pMetafile, 0); pCanvas->Brush->Color = clRed; pCanvas->Ellipse(0,0,100,100); FILE *fpW; fpW=fopen("h","wb") ; fwrite(pMetafile,sizeof(*pMetafile),1,fpW); fclose(fpW); delete pCanvas; delete pMetafile;//If we comment this statement Ellipse is not drawn TMetafile *pMetafile1 = new TMetafile; fpW=fopen("h","rb"); fread(pMetafile1,sizeof(*pMetafile1),1,fpW); fclose(fpW) ; Form1->Canvas->Draw(0,0,pMetafile1);
If the pMetafile is deleted after saving the data into file then the code will not draw Ellipse. Is it there any way to store and retrive the Metafile Info. -
TMetafile *pMetafile = new TMetafile; TMetafileCanvas *pCanvas = new TMetafileCanvas(pMetafile, 0); pCanvas->Brush->Color = clRed; pCanvas->Ellipse(0,0,100,100); FILE *fpW; fpW=fopen("h","wb") ; fwrite(pMetafile,sizeof(*pMetafile),1,fpW); fclose(fpW); delete pCanvas; delete pMetafile;//If we comment this statement Ellipse is not drawn TMetafile *pMetafile1 = new TMetafile; fpW=fopen("h","rb"); fread(pMetafile1,sizeof(*pMetafile1),1,fpW); fclose(fpW) ; Form1->Canvas->Draw(0,0,pMetafile1);
If the pMetafile is deleted after saving the data into file then the code will not draw Ellipse. Is it there any way to store and retrive the Metafile Info.