在对话框中,如何显示位图?? Put the :Invalidate();UpdateWindow();StretchBlt();in the OnPaint()You should move the StretchBlt() into the Onpaint() 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 CBitmap bmp;bmp.LoadPicture()Bitblt() 我移到OnPaint()里面了,但是还是没反应? 用LoadBitMap Bitblt()就可以了 in CMyDlg::OnPaint(){CPictureHolder picHolder;picHolder.CreateFromBitmap(bhm_ddb);//get render and bound rect......picHolder.Render(pDC,rcRender, rcWBounds);} 简单而没问题的代码:(使用256色位图测试)void CDlgDlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); // Center icon in client rectangle int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon dc.DrawIcon(x, y, m_hIcon); } else { CBitmap bmp; if(!bmp.LoadBitmap(IDB_BITMAP1)) return; BITMAP bm; bmp.GetObject(sizeof(BITMAP),&bm); CPaintDC dc(this); CDC mem; if(!mem.CreateCompatibleDC(&dc)) return; CBitmap *pOld =(CBitmap *)mem.SelectObject(&bmp); dc.BitBlt(0,0,bm.bmWidth,bm.bmHeight,&mem,0,0,SRCCOPY); mem.SelectObject(pOld); CDialog::OnPaint(); }}如果还有问题,再联系 将CStatic* m_pic; 定义为对话框的类变量。再试试! 对WideCharToMultiByte返回值的迷惑 随雨(rendao0563)进来)利用PdhAddCounter获取I/O相关信息和网络信息 登陆网站的时候,有没有一台机器登陆很多ID的办法 是所有的dll文件都可以动态加载吗? 读文件,若能解决,马上结贴. 如何在状态条将一个32x32的图标按16x16显示(就像IE6中状态条中的图标) 有什么com、DCOM组件的入门书吗?我只会MFC 下拉工具栏的实现 多线程对数据库操作 WDM到底有什么用?VXD能干的WDM都能干吗? 如何得到拆分窗口到底哪个视图是激活的??? 在vc中如何将int型的转为字符型输出?有分阿!
bmp.LoadPicture()Bitblt()
Bitblt()
就可以了
{
CPictureHolder picHolder;
picHolder.CreateFromBitmap(bhm_ddb);
//get render and bound rect......picHolder.Render(pDC,rcRender, rcWBounds);
}
void CDlgDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); // Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CBitmap bmp;
if(!bmp.LoadBitmap(IDB_BITMAP1))
return;
BITMAP bm;
bmp.GetObject(sizeof(BITMAP),&bm);
CPaintDC dc(this);
CDC mem;
if(!mem.CreateCompatibleDC(&dc))
return;
CBitmap *pOld =(CBitmap *)mem.SelectObject(&bmp);
dc.BitBlt(0,0,bm.bmWidth,bm.bmHeight,&mem,0,0,SRCCOPY);
mem.SelectObject(pOld);
CDialog::OnPaint();
}
}
如果还有问题,再联系
再试试!