Hi
I am using MSFlexGrid in Visual C++ .Net enviournment to display
Images in it cells, Displaying images working fine. But when I am
changing images in cells frequently, after some time images getting
disapear. I am using following code
to display an image in my flex grid.
I am passing following arguments to my function
1) pointer to my flex grid
2) Column number
3) Row Number
4) Image Resource ID
5) Text string (to display if needed in top of the image in given cell)
===========================================================================
void CNTBCommon::setImage(CMsflexgrid * flxGrid, int iCol, int iRow,
UINT uiImageID,CString strDisplayText)
{
IDispatch *pDisp;
PICTDESC pictDesc;
memset(&pictDesc, 0, sizeof(pictDesc));
pictDesc.cbSizeofstruct = sizeof(pictDesc);
pictDesc.bmp.hpal = 0;
HBITMAP hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(),
MAKEINTRESOURCE(uiImageID),
IMAGE_BITMAP,
0,0,
LR_LOADMAP3DCOLORS);
pictDesc.bmp.hbitmap = hBmp;
pictDesc.picType = PICTYPE_BITMAP;
HRESULT hr = OleCreatePictureIndirect(&pictDesc,
IID_IDispatch,
FALSE,
(void**)&pDisp);
if(SUCCEEDED(hr)&&SUCCEEDED(hr1))
{
flxGrid->put_Col(iCol);
flxGrid->put_Row(iRow);
flxGrid->putref_CellPicture(pDisp);
pDisp->Release();
flxGrid->put_TextMatrix(iRow,iCol,strDisplayText);
flxGrid->UpdateWindow();
}
}
======================================================
thank you
venura |