不需要多复杂~ 只要能实现 把两张图片按顺序从左到右 拼到一起就行了~
小弟刚开始学C++ 请给出详细代码。。最好有注释。。。。
5 个解决方案
#1
这个,有点。。。
#2
....
有点什么呢。。。哈哈~
会吗?会的话贴出来吧~特别着急呢~在线等呢~
谢谢拉拉!!!!
#3
郁闷。。。怎么没人答复啊。。
#4
可以创建一个基于对话框的应用程序
给对话框添加paint函数
在函数中添加
CDC dcMem;
CBitmap bmpMem,*oldbmpMem;
dcMem.CreateCompatibleDC(&dc);
bmpMem.CreateCompatibleBitmap(&dc,800,480);
oldbmpMem=dcMem.SelectObject(&bmpMem);
CDC dcMem2;
dcMem2.CreateCompatibleDC(&dcMem);
CBitmap bmpMem2;
CString photo1=L"D:\\photo.bmp\0";
CString photo2=L"D:\\photo2.bmp\0";
bmpMem2.m_hObject=SHLoadDIBitmap(photo1);
dcMem2.SelectObject(&bmpMem2);
dcMem.BitBlt(x1,y1,w1,h1,&dcMem2,0,0,SRCCOPY);
bmpMem2.m_hObject=SHLoadDIBitmap(photo2);
dcMem2.SelectObject(&bmpMem2);
dcMem.BitBlt(x2,y2,w2,h2,&dcMem2,0,0,SRCCOPY);
dc.BitBlt(0,0,800,480,&dcMem,0,0,SRCCOPY);
bmpMem2.DeleteObject();
dcMem2.DeleteDC();
dcMem.SelectObject(oldbmpMem);
bmpMem.DeleteObject();
dcMem.DeleteDC();
x,y,w,h,分别为两张图片的在对话框的左、上坐标以及长和宽
如果两张位图是100*50
x1=0,y1=0 ,w1=100, h1=50
x2=100,y2=0,w2=100, h2=50
给对话框添加paint函数
在函数中添加
CDC dcMem;
CBitmap bmpMem,*oldbmpMem;
dcMem.CreateCompatibleDC(&dc);
bmpMem.CreateCompatibleBitmap(&dc,800,480);
oldbmpMem=dcMem.SelectObject(&bmpMem);
CDC dcMem2;
dcMem2.CreateCompatibleDC(&dcMem);
CBitmap bmpMem2;
CString photo1=L"D:\\photo.bmp\0";
CString photo2=L"D:\\photo2.bmp\0";
bmpMem2.m_hObject=SHLoadDIBitmap(photo1);
dcMem2.SelectObject(&bmpMem2);
dcMem.BitBlt(x1,y1,w1,h1,&dcMem2,0,0,SRCCOPY);
bmpMem2.m_hObject=SHLoadDIBitmap(photo2);
dcMem2.SelectObject(&bmpMem2);
dcMem.BitBlt(x2,y2,w2,h2,&dcMem2,0,0,SRCCOPY);
dc.BitBlt(0,0,800,480,&dcMem,0,0,SRCCOPY);
bmpMem2.DeleteObject();
dcMem2.DeleteDC();
dcMem.SelectObject(oldbmpMem);
bmpMem.DeleteObject();
dcMem.DeleteDC();
x,y,w,h,分别为两张图片的在对话框的左、上坐标以及长和宽
如果两张位图是100*50
x1=0,y1=0 ,w1=100, h1=50
x2=100,y2=0,w2=100, h2=50
#5
杯具了,上面的代码是WinCE的
用下面的,在OnPaint函数 前面加
CPaintDC dc(this);
CDC dcMem;
dcMem.CreateCompatibleDC(&dc);
CBitmap bmpMem2;
bmpMem2.LoadBitmap(IDB_BITMAP1);
dcMem.SelectObject(&bmpMem2);
dc.BitBlt(0,0,70,45,&dcMem,0,0,SRCCOPY);
CBitmap bmpMem1;
bmpMem1.LoadBitmap(IDB_BITMAP2);
dcMem.SelectObject(&bmpMem1);
dc.BitBlt(70,0,70,45,&dcMem,0,0,SRCCOPY);
bmpMem1.DeleteObject();
bmpMem2.DeleteObject();
dcMem.DeleteDC();
IDB_BITMAP1 和IDB_BITMAP2是加载位图资源后两个位图的ID
用下面的,在OnPaint函数 前面加
CPaintDC dc(this);
CDC dcMem;
dcMem.CreateCompatibleDC(&dc);
CBitmap bmpMem2;
bmpMem2.LoadBitmap(IDB_BITMAP1);
dcMem.SelectObject(&bmpMem2);
dc.BitBlt(0,0,70,45,&dcMem,0,0,SRCCOPY);
CBitmap bmpMem1;
bmpMem1.LoadBitmap(IDB_BITMAP2);
dcMem.SelectObject(&bmpMem1);
dc.BitBlt(70,0,70,45,&dcMem,0,0,SRCCOPY);
bmpMem1.DeleteObject();
bmpMem2.DeleteObject();
dcMem.DeleteDC();
IDB_BITMAP1 和IDB_BITMAP2是加载位图资源后两个位图的ID
#1
这个,有点。。。
#2
....
有点什么呢。。。哈哈~
会吗?会的话贴出来吧~特别着急呢~在线等呢~
谢谢拉拉!!!!
#3
郁闷。。。怎么没人答复啊。。
#4
可以创建一个基于对话框的应用程序
给对话框添加paint函数
在函数中添加
CDC dcMem;
CBitmap bmpMem,*oldbmpMem;
dcMem.CreateCompatibleDC(&dc);
bmpMem.CreateCompatibleBitmap(&dc,800,480);
oldbmpMem=dcMem.SelectObject(&bmpMem);
CDC dcMem2;
dcMem2.CreateCompatibleDC(&dcMem);
CBitmap bmpMem2;
CString photo1=L"D:\\photo.bmp\0";
CString photo2=L"D:\\photo2.bmp\0";
bmpMem2.m_hObject=SHLoadDIBitmap(photo1);
dcMem2.SelectObject(&bmpMem2);
dcMem.BitBlt(x1,y1,w1,h1,&dcMem2,0,0,SRCCOPY);
bmpMem2.m_hObject=SHLoadDIBitmap(photo2);
dcMem2.SelectObject(&bmpMem2);
dcMem.BitBlt(x2,y2,w2,h2,&dcMem2,0,0,SRCCOPY);
dc.BitBlt(0,0,800,480,&dcMem,0,0,SRCCOPY);
bmpMem2.DeleteObject();
dcMem2.DeleteDC();
dcMem.SelectObject(oldbmpMem);
bmpMem.DeleteObject();
dcMem.DeleteDC();
x,y,w,h,分别为两张图片的在对话框的左、上坐标以及长和宽
如果两张位图是100*50
x1=0,y1=0 ,w1=100, h1=50
x2=100,y2=0,w2=100, h2=50
给对话框添加paint函数
在函数中添加
CDC dcMem;
CBitmap bmpMem,*oldbmpMem;
dcMem.CreateCompatibleDC(&dc);
bmpMem.CreateCompatibleBitmap(&dc,800,480);
oldbmpMem=dcMem.SelectObject(&bmpMem);
CDC dcMem2;
dcMem2.CreateCompatibleDC(&dcMem);
CBitmap bmpMem2;
CString photo1=L"D:\\photo.bmp\0";
CString photo2=L"D:\\photo2.bmp\0";
bmpMem2.m_hObject=SHLoadDIBitmap(photo1);
dcMem2.SelectObject(&bmpMem2);
dcMem.BitBlt(x1,y1,w1,h1,&dcMem2,0,0,SRCCOPY);
bmpMem2.m_hObject=SHLoadDIBitmap(photo2);
dcMem2.SelectObject(&bmpMem2);
dcMem.BitBlt(x2,y2,w2,h2,&dcMem2,0,0,SRCCOPY);
dc.BitBlt(0,0,800,480,&dcMem,0,0,SRCCOPY);
bmpMem2.DeleteObject();
dcMem2.DeleteDC();
dcMem.SelectObject(oldbmpMem);
bmpMem.DeleteObject();
dcMem.DeleteDC();
x,y,w,h,分别为两张图片的在对话框的左、上坐标以及长和宽
如果两张位图是100*50
x1=0,y1=0 ,w1=100, h1=50
x2=100,y2=0,w2=100, h2=50
#5
杯具了,上面的代码是WinCE的
用下面的,在OnPaint函数 前面加
CPaintDC dc(this);
CDC dcMem;
dcMem.CreateCompatibleDC(&dc);
CBitmap bmpMem2;
bmpMem2.LoadBitmap(IDB_BITMAP1);
dcMem.SelectObject(&bmpMem2);
dc.BitBlt(0,0,70,45,&dcMem,0,0,SRCCOPY);
CBitmap bmpMem1;
bmpMem1.LoadBitmap(IDB_BITMAP2);
dcMem.SelectObject(&bmpMem1);
dc.BitBlt(70,0,70,45,&dcMem,0,0,SRCCOPY);
bmpMem1.DeleteObject();
bmpMem2.DeleteObject();
dcMem.DeleteDC();
IDB_BITMAP1 和IDB_BITMAP2是加载位图资源后两个位图的ID
用下面的,在OnPaint函数 前面加
CPaintDC dc(this);
CDC dcMem;
dcMem.CreateCompatibleDC(&dc);
CBitmap bmpMem2;
bmpMem2.LoadBitmap(IDB_BITMAP1);
dcMem.SelectObject(&bmpMem2);
dc.BitBlt(0,0,70,45,&dcMem,0,0,SRCCOPY);
CBitmap bmpMem1;
bmpMem1.LoadBitmap(IDB_BITMAP2);
dcMem.SelectObject(&bmpMem1);
dc.BitBlt(70,0,70,45,&dcMem,0,0,SRCCOPY);
bmpMem1.DeleteObject();
bmpMem2.DeleteObject();
dcMem.DeleteDC();
IDB_BITMAP1 和IDB_BITMAP2是加载位图资源后两个位图的ID