多图片会有重叠的问题,一张图片的给你写出来了
#include "stdafx.h"
#include <graphics.h>
IMAGE img;
int x, y;
int main()
{
initgraph(640, 480);
MOUSEMSG m; // 定义鼠标消息
loadimage(&img, _T("路径"));
putimage(0, 0, &img);
while (true)
{
m = GetMouseMsg();
while (m.uMsg != WM_LBUTTONDOWN)m = GetMouseMsg();
while(m.uMsg != WM_LBUTTONUP)
{
m = GetMouseMsg();// 获取一条鼠标消息
cleardevice();
x = m.x;
y = m.y;
putimage(x, y, &img);
}
}
closegraph();// 关闭图形窗口
}