//这是把一张150*150的BMP图片拼成10行10列,成为一个1500*1500的图
void CTestDlg::OnPaint()
{
CClientDC dc(this);
m_dcMem.CreateCompatibleDC( &dc );
HBITMAP hBmpNew = (HBITMAP)LoadImage(AfxGetInstanceHandle(), "E:\\tablen.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
if( hBmpNew != NULL )
{
HBITMAP hBmpOld = (HBITMAP)SelectObject(m_dcMem, hBmpNew);
BITMAP bmInfo;
GetObject( hBmpNew , sizeof(BITMAP), &bmInfo ); int iX = 0;
int iY = 0;
for (int iRowIndex = 0; iRowIndex < 10; iRowIndex++)
{
for (int iColIndex = 0; iColIndex < 10; iColIndex++)
{
dc.BitBlt(iX, iY, bmInfo.bmWidth, bmInfo.bmHeight, &m_dcMem, 0, 0, SRCCOPY); iX += bmInfo.bmWidth;
} iX = 0;
iY += bmInfo.bmHeight;
} DeleteObject(hBmpNew);
}
CDialog::OnPaint();
}我想问的是,如何让这拼接步骤在内存DC中做,然后把拼好的图一次性的画在屏幕DC上?
也就是:void CTestDlg::DrawMem()
{
//把一张150*150的BMP图片拼成10行10列,成为一个1500*1500的图
//这里怎么写呢?
}
void CTestDlg::OnPaint()
{
CClientDC dc(this);
dc.BitBlt(iX, iY, bmInfo.bmWidth, bmInfo.bmHeight, &m_dcMem, 0, 0, SRCCOPY); CDialog::OnPaint();
}
解决方案 »
- 终于明白为什么在父窗口的wm_paint 中无法对子控件进行进行gdi操作了
- VC 字符转ASC
- CTreeView中怎么样正确显示大于65535个的数据?
- 请大家帮个忙~~~初学者问题~~
- 半角与全角输入在listctrl中顺序为什么会发生变化!
- 为什么创建套接字报错?sListen=socket(AF_INET,SOCK_STREAM,IPPROTO_IP);
- STL在MFC中的使用警告!
- 程序运行时将combobox的style改为drop list,modifystyle返回成功,为何仍能编辑?
- 这个问题怎么解决?
- 显式调用动态连接库
- 怎么操作LISTVIEW
- vc6 win32dll,导出非mfc的导出类实例,能创建实例,怎么访问属性出错啊,谁能说一下具体问题所在啊
{
//把一张150*150的BMP图片拼成10行10列,成为一个1500*1500的图
//这里怎么写呢?
}
void CTestDlg::OnPaint()
{
CClientDC dc(this); CMemDC memDC(&dc);
DrawElement(memDC); memDC.BitBlt(iX, iY, bmInfo.bmWidth, bmInfo.bmHeight, &m_dcMem, 0, 0, SRCCOPY); CDialog::OnPaint();
}
{
SIZE bmSize;
CDC hDC;
hDC.CreateCompatibleDC( memDC);
HBITMAP hBmpNew = (HBITMAP)LoadImage(AfxGetInstanceHandle(), "E:\\tablen.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
if( hBmpNew != NULL )
{
HBITMAP hBmpOld = (HBITMAP)SelectObject(hDC, hBmpNew);
BITMAP bmInfo;
GetObject( hBmpNew , sizeof(BITMAP), &bmInfo );
bmSize.cx = bmInfo.bmWidth;
bmSize.cy = bmInfo.bmHeight;
int iX = 0;
int iY = 0;
for (int iRowIndex = 0; iRowIndex < 10; iRowIndex++)
{
for (int iColIndex = 0; iColIndex < 10; iColIndex++)
{
memDC->BitBlt(iX, iY, bmInfo.bmWidth, bmInfo.bmHeight, &hDC, 0, 0, SRCCOPY); iX += bmInfo.bmWidth;
} iX = 0;
iY += bmInfo.bmHeight;
} DeleteObject(hBmpNew);
}
return bmSize;
}void CTestDlg::OnPaint()
{
CClientDC dc(this);
m_dcMem.CreateCompatibleDC( &dc );
SIZE bmSize = DrawMem(&m_dcMem);
dc.BitBlt(0,0,bmSize.cx*10, bmSize.cy*10, &m_dcMem, 0, 0, SRCCOPY); CDialog::OnPaint();
}
//这是把一张150*150的BMP图片拼成10行10列,成为一个1500*1500的图
void CTestDlg::OnPaint()
{
CClientDC dc(this);
m_dcMem.CreateCompatibleDC( &dc );
CDC hDC;
hDC.CreateCompatibleDC( m_dcMem); HBITMAP hBmpNew = (HBITMAP)LoadImage(AfxGetInstanceHandle(), "E:\\tablen.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
if( hBmpNew != NULL )
{
HBITMAP hBmpOld = (HBITMAP)SelectObject(hDC, hBmpNew);
BITMAP bmInfo;
GetObject( hBmpNew , sizeof(BITMAP), &bmInfo ); int iX = 0;
int iY = 0;
for (int iRowIndex = 0; iRowIndex < 10; iRowIndex++)
{
for (int iColIndex = 0; iColIndex < 10; iColIndex++)
{
m_dcMem.BitBlt(iX, iY, bmInfo.bmWidth, bmInfo.bmHeight, &hDC, 0, 0, SRCCOPY); iX += bmInfo.bmWidth;
} iX = 0;
iY += bmInfo.bmHeight;
} DeleteObject(hBmpNew);
} dc.BitBlt(iX, iY, bmInfo.bmWidth, bmInfo.bmHeight, &m_dcMem, 0, 0, SRCCOPY); CDialog::OnPaint();
}