Board index » cppbuilder » Determine Graphic Type witin TImage

Determine Graphic Type witin TImage


2004-11-22 06:28:48 AM
cppbuilder33
I'm using a TImage to allow users to copy/paste graphics from the clipboard.
I need to be able to save these graphics to file but I can't seem to
determine their graphic type so that I can put the correct extension on the
files.
Can anyone help me determine the graphic type within a TImage component?
 
 

Re:Determine Graphic Type witin TImage

I would do something like this:
AnsiString PictType = Image1->Picture->Graphic->ClassName();
if (PictType == "TBitmap")
Image1->Picture->SaveToFile("test.bmp");
else if (PictType == "TIcon")
Image1->Picture->SaveToFile("test.ico");
else if (PictType == "TMetafile") {
if (Image1->Picture->Metafile->Enhanced == true)
Image1->Picture->SaveToFile("test.emf");
else
Image1->Picture->SaveToFile("test.wmf");
}
Eudy
Daniel Stevenson wrote:
Quote
I'm using a TImage to allow users to copy/paste graphics from the clipboard.

I need to be able to save these graphics to file but I can't seem to
determine their graphic type so that I can put the correct extension on the
files.

Can anyone help me determine the graphic type within a TImage component?