User (Legacy) Posted December 23, 2002 Report Share Posted December 23, 2002 Does anyone have an example showing how a bitmap, icon or whatever is added to a command object to be used in a chart menu? How is the IPictureDisp used? Link to comment Share on other sites More sharing options...
Software FX Posted December 23, 2002 Report Share Posted December 23, 2002 The following sample code adds a picture to the command bar and then adds an item to the toolbar containing the added picture: // Load picture from resources. IDB_BITMAP1 is a 16-Color bitmap measuring 16x15 pixels IPictureDispPtr pPicDisp; PICTDESC pd; pd.cbSizeofstruct = sizeof(pd); pd.picType = PICTYPE_BITMAP; pd.bmp.hbitmap = LoadBitmap(theApp.m_hInstance,MAKEINTRESOURCE(IDB_BITMAP1)); OleCreatePictureIndirect(&pd,IID_IPictureDisp,TRUE,(LPVOID *)&pPicDisp); // Add picture to command bar int nPicture = m_pChartFX->Commands->AddPicture(pPicDisp); // Add command to command bar m_pChartFX->Commands->AddCommand(101); // Assign recently added picture to new command m_pChartFX->Commands->Item[101]->Picture = nPicture; // Replace first toolbar buttun with recently added command m_pChartFX->ToolBarObj->Item[0]->CommandID = 101; You can try this code by adding it to the MFC sample we provide, you will need to add a bitmap IDB_BITMAP1 to your project as well. -- FP Software FX Support "David Freer" <freer.mail@worldnet.att.net> wrote in message news:w3KCU6qqCHA.2684@webserver1.softwarefx.com... > Does anyone have an example showing how a bitmap, icon or whatever is added > to a command object to be used in a chart menu? How is the IPictureDisp > used? > > Link to comment Share on other sites More sharing options...
User (Legacy) Posted January 11, 2003 Author Report Share Posted January 11, 2003 Thank you. It works great. "Software FX Support" <support@softwarefx.com> wrote in message news:ResTcYtqCHA.3228@webserver1.softwarefx.com... > The following sample code adds a picture to the command bar and then adds an > item to the toolbar containing the added picture: > > // Load picture from resources. IDB_BITMAP1 is a 16-Color bitmap measuring > 16x15 pixels > IPictureDispPtr pPicDisp; > PICTDESC pd; > > pd.cbSizeofstruct = sizeof(pd); > pd.picType = PICTYPE_BITMAP; > pd.bmp.hbitmap = > LoadBitmap(theApp.m_hInstance,MAKEINTRESOURCE(IDB_BITMAP1)); > OleCreatePictureIndirect(&pd,IID_IPictureDisp,TRUE,(LPVOID *)&pPicDisp); > > // Add picture to command bar > int nPicture = m_pChartFX->Commands->AddPicture(pPicDisp); > > // Add command to command bar > m_pChartFX->Commands->AddCommand(101); > > // Assign recently added picture to new command > m_pChartFX->Commands->Item[101]->Picture = nPicture; > > // Replace first toolbar buttun with recently added command > m_pChartFX->ToolBarObj->Item[0]->CommandID = 101; > > > You can try this code by adding it to the MFC sample we provide, you will > need to add a bitmap IDB_BITMAP1 to your project as well. > > -- > FP > Software FX Support > "David Freer" <freer.mail@worldnet.att.net> wrote in message > news:w3KCU6qqCHA.2684@webserver1.softwarefx.com... > > Does anyone have an example showing how a bitmap, icon or whatever is > added > > to a command object to be used in a chart menu? How is the IPictureDisp > > used? > > > > > > Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.