可以请教你怎么在MFC的子对话框中插入背景图片吗?
2个回答
展开全部
在自对话框里添加消息映射 OnPaint
void CEasyList::OnPaint()
{
CPaintDC dc(this);
DrawBitmap( bitmap , dc.m_hDC ,0,0,1000,1000 ) ;
}
void DrawBitmap(HBITMAP m_bitmap,HDC hScrDC,int x=0,int y=0,int width=100,int height=100)
{
HDC hMemDC=CreateCompatibleDC(hScrDC); //创建内存DC
::SelectObject(hMemDC,m_bitmap); //把位图选进内存DC
BitBlt(hScrDC,x,y,width,height,hMemDC,0,0,SRCCOPY); //内存DC映射到屏幕DC
::DeleteDC(hMemDC) ; //删除内存DC
}
void CEasyList::OnPaint()
{
CPaintDC dc(this);
DrawBitmap( bitmap , dc.m_hDC ,0,0,1000,1000 ) ;
}
void DrawBitmap(HBITMAP m_bitmap,HDC hScrDC,int x=0,int y=0,int width=100,int height=100)
{
HDC hMemDC=CreateCompatibleDC(hScrDC); //创建内存DC
::SelectObject(hMemDC,m_bitmap); //把位图选进内存DC
BitBlt(hScrDC,x,y,width,height,hMemDC,0,0,SRCCOPY); //内存DC映射到屏幕DC
::DeleteDC(hMemDC) ; //删除内存DC
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询