Vc窗口下加载位图,为毛只有窗口没得图片呢???
// ckWnd.cpp : implementation file//
//#include "stdafx.h"
#include "ck.h"
#include "ckWnd.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// ckWnd
IMPLEMENT_DYNCREATE(ckWnd, CFrameWnd)
int i ;
ckWnd::ckWnd()
{
Create(NULL, "窗口");
bitmap = new CBitmap;
bitmap->m_hObject= LoadImage(NULL, "1.1.bmp", IMAGE_BITMAP, 600, 450, LR_LOADFROMFILE);
mdc = new CDC;
CClientDC dc(this);
mdc->CreateCompatibleDC(&dc);
mdc->SelectObject(bitmap);
i = 0;
}
ckWnd::~ckWnd()
{
}
BEGIN_MESSAGE_MAP(ckWnd, CFrameWnd)
//{{AFX_MSG_MAP(ckWnd)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// ckWnd message handlers
void ckWnd::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
if (i++<300)
{
dc.BitBlt(0+i,0,600,450,mdc,0,0,SRCCOPY);
}
else
i = 0;
// Do not call CFrameWnd::OnPaint() for painting messages
}