Jump to content
Software FX Community

Logo picture


User (Legacy)

Recommended Posts

I use ChartFX in an MFC/MDI project.

I need to show a small logo picture inside ChartFX. Is usage of Annotation

pictures the only way of doing this? I would prefer not to use loading

pictures from file since files do not exist (all pictures stored either in

the project resources or inside Documents). Otherwise I will have to create

a file before loading it again in the application which is odd.

Any advice is appreciated.

Link to comment
Share on other sites

Annotation objects can be used without a file.

The AnnPicture object has a property of type Image (COM's IPictureDisp

interface) that you can assign from a previously loaded image which can come

from either your own resources, a file or anywhere else.

To use this functionality from VC++ you can do:

PICTDESC pd;

pd.cbSizeofstruct = sizeof(pd);

pd.picType = PICTYPE_BITMAP;

pd.bmp.hbitmap =

LoadBitmap(theApp.m_hInstance,MAKEINTRESOURCE(IDB_BITMAP1));

pd.bmp.hpal = NULL;

IPictureDispPtr picture;

if (SUCCEEDED(OleCreatePictureIndirect(&pd, IID_IPictureDisp, FALSE,

(LPVOID*)&picture))) {

IAnnPicturePtr annPicture = annotation->Add((short)

OBJECT_TYPE_PICTURE);

annPicture->Width = 100;

annPicture->Height = 100;

annPicture->putref_Picture(picture);

}

--

FP

Software FX

Link to comment
Share on other sites

Thank you very much! It works.

"SoftwareFX Support" <noreply@softwarefx.com> wrote in message

news:2%23oY7VOzEHA.1120@webserver3.softwarefx.com...

> Annotation objects can be used without a file.

>

> The AnnPicture object has a property of type Image (COM's IPictureDisp

> interface) that you can assign from a previously loaded image which can

come

> from either your own resources, a file or anywhere else.

>

> To use this functionality from VC++ you can do:

>

> PICTDESC pd;

>

> pd.cbSizeofstruct = sizeof(pd);

>

> pd.picType = PICTYPE_BITMAP;

>

> pd.bmp.hbitmap =

> LoadBitmap(theApp.m_hInstance,MAKEINTRESOURCE(IDB_BITMAP1));

>

> pd.bmp.hpal = NULL;

>

> IPictureDispPtr picture;

>

> if (SUCCEEDED(OleCreatePictureIndirect(&pd, IID_IPictureDisp, FALSE,

> (LPVOID*)&picture))) {

>

> IAnnPicturePtr annPicture = annotation->Add((short)

> OBJECT_TYPE_PICTURE);

>

> annPicture->Width = 100;

>

> annPicture->Height = 100;

>

> annPicture->putref_Picture(picture);

>

> }

>

>

> --

> FP

> Software FX

>

>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...