Access数据库之图像不能显示

在使用Access2010时会遇到设定的OLE对象不能加载问题,可能会出现在窗体中只是显示“xxx.bmp”或者报表中不能显示,解决办法是,将字段设定为“附件”类型,如图所示:

此时,在窗体里面就可以看到图像了,如图所示:

此时就解决了窗体不能显示图片的问题了,至于报表中不能显示正在解决中,会及时更新的......


。。。。。2018-8-15更新。。。。。找到窗体中图片显示wei为“图名.格式”的解决办法了。。。。。

不能显示bmp图像

04-30

在CDoc中打开bmprn然后在CView中显示bmprn发现打开文件后,窗口没有显示图片,非的吧窗口最小或者最大化才能显示出图片rn是不是要添加一个刷新的函数啊,我是菜鸟,不知道添加什么函数能刷新,麻烦大家了rnvoid CMyShowDoc::OnFileOpen() rnrn // TODO: Add your command handler code herern CFileDialog dlg(TRUE,_T("BMP"),_T("*.BMP"),OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,_T("位图文件(*.BMP)|*.BMP|")); rn if(IDOK==dlg.DoModal ())rn filename.Format ("%s",dlg.GetPathName() ); rn CBmp.LoadFile(filename);rn OpenFile=1;rnrnrnrnvoid CMyShowView::OnDraw(CDC* pDC)rnrn CMyShowDoc* pDoc = GetDocument();rn ASSERT_VALID(pDoc);rn // TODO: add draw code for native data herern CBmpNew=&pDoc->CBmp; rn if(pDoc->OpenFile==1)rn rn BYTE* pBitmapData = CBmpNew->GetData();rn LPBITMAPINFO pBitmapInfo = CBmpNew->GetInfo();rn int bitmapHeight = CBmpNew->GetHeight();rn int bitmapWidth = CBmpNew->GetWidth();rn int scaledWidth = (int)(bitmapWidth*1);rn int scaledHeight = (int)(bitmapHeight*1);rn if (CBmpNew->GetRGB()) // Has a color tablern rn CPalette * hPalette1=CreateBitmapPalette(CBmpNew);rn CPalette * hOldPalette=pDC->SelectPalette(hPalette1, true);rn pDC->RealizePalette();rn ::StretchDIBits(pDC->GetSafeHdc(),0,0, scaledWidth, scaledHeight,rn 0, 0, bitmapWidth , bitmapHeight ,rn pBitmapData, pBitmapInfo,rn DIB_RGB_COLORS, SRCCOPY);rn pDC->SelectPalette(hOldPalette, true);rn hPalette.DeleteObject();rnrn rn elsern rn ::StretchDIBits(pDC->GetSafeHdc(),rn 0, 0, scaledWidth, scaledHeight,rn 0, 0, bitmapWidth, bitmapHeight,rn pBitmapData, pBitmapInfo,rn DIB_RGB_COLORS, SRCCOPY);rn rnrn

求助,图像不能显示

05-09

我想把一幅图像放大一些,放大为:Swidth=sw*width, Sheight=sh*width,rn写了如下代码,但是调试不通,图像不能显示。rnrn //获得当前DIB的句柄rn CDemoDoc *pDoc=GetDocument(); rn HDIB dib=pDoc->GetHDIB(); rnrn LPSTR lpDIB = (LPSTR) ::GlobalLock((HGLOBAL) dib); //锁定该句柄标识的内存块rnrn int width = ::DIBWidth(lpDIB); rn int height = ::DIBHeight(lpDIB);rn LPBITMAPINFOHEADER phead=(LPBITMAPINFOHEADER)lpDIB;rn int biBitCount = phead->biBitCount/8;rnrn int lineByte=(width * biBitCount+3)/4*4;rn unsigned char *lpDIBBits=(unsigned char *)::FindDIBBits(lpDIB); rn int palSize=::PaletteSize((LPSTR)lpDIB);rn rn //新建一个图像句柄rn int Swidth=(int)(width*sw+0.5);rn int Sheight=(int)(height*sh+0.5);rn int SlineByte=(Swidth*biBitCount+3)/4*4;rnrn HANDLE dibNew=::GlobalAlloc(GHND, sizeof(BITMAPINFOHEADER)+ palSize+Sheight*SlineByte);rn LPSTR lpDIBNew = (LPSTR) ::GlobalLock(dibNew);rn LPBITMAPINFOHEADER lpNewHead= (LPBITMAPINFOHEADER)::GlobalLock(dibNew);rn unsigned char *lpDIBBitsNew=(unsigned char *)::FindDIBBits(lpDIBNew);rn unsigned char *lpDIBPalette=(unsigned char*)lpDIBNew+sizeof(BITMAPINFOHEADER);rnrn ::memcpy((unsigned char*)lpDIBNew, (unsigned char*)lpDIB, rn sizeof(BITMAPINFOHEADER)+ palSize);rnrn// lpNewHead->biBitCount=biBitCount*8;rn// lpNewHead->biClrImportant=0;rn// lpNewHead->biClrUsed=0;rn// lpNewHead->biCompression=BI_RGB;rn lpNewHead->biHeight=Sheight;rn// lpNewHead->biPlanes=1;rn// lpNewHead->biSize=sizeof(BITMAPINFOHEADER);rn lpNewHead->biSizeImage=SlineByte*Sheight;rn lpNewHead->biWidth=Swidth;rn// lpNewHead->biXPelsPerMeter=0;rn// lpNewHead->biYPelsPerMeter=0;rn rn //欲将图像显示为全黑rn int i,j,k;rn for( i=0; i< Sheight; i++ )rn for( j=0; jm_pMainWnd); // 获取主框架窗口的指针rn pFrame->SendMessage(WM_COMMAND, ID_FILE_NEW); // 新建一个子窗口rn rn CDemoView* pView=(CDemoView*)pFrame->MDIGetActive()->GetActiveView(); //获得View(已建立)指针rn CDemoDoc* pDocNew=pView->GetDocument(); //获取文档指针rn rn pDocNew->ReplaceHDIB((HDIB)dibNew); //替换DIB,同时释放旧DIB对象rn pDocNew->InitDIBData(); // 更新DIB大小和调色板rn pDocNew->UpdateAllViews(pView);rn Invalidate();rnrn结果在窗口上显示全白(应该根本是没有显示出来),望各位出手相助!!

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试