>_<:picture resource
>_<:If you master the ways of mapping picture,then this problem is not problem!Just using your head think some logical method.
>_<:Here,I use a array save where and whith picture should show.For example:use array mapindex save information.then when you map these pictures,only need to calculate the real position and then move it to the bufdc ,finally put it in the mdc (here bufdc in charge of making an exchange between every picture and mdc)
int mapindex[rows*cols]= {2,2,3,2,0,1,0,1, 0,2,2,0,3,0,1,1, 0,3,0,7,0,0,0,1, 2,0,3,0,0,0,2,2, 2,7,0,6,0,2,2,2, 2,0,4,0,2,2,0,0, 0,0,2,3,2,1,0,1, 0,0,2,0,3,0,1,1 };
1 //按照mapIndex 数组中的定义取出对应图块,进行地图拼接 2 for(i=0;i<rows*cols;i++) 3 { 4 SelectObject(bufdc,map[mapindex[i]]); 5 rowNum=i/cols;//求列编号 6 colNum=i%cols;//求行编号 7 x=colNum*50;//求贴图x坐标 8 y=rowNum*50; 9 10 BitBlt(mdc,x,y,50,50,bufdc,0,0,SRCCOPY); 11 }
>_<:Finally, only need to copy mdc to hdc.
>_<:Here is the cod
本文转自beautifulzzzz博客园博客,原文链接:http://www.cnblogs.com/zjutlitao/p/3733894.html,如需转载请自行联系原作者