//--------------------------------------------MyPaint() 函数---------------------------------------------------
//绘制图形
//-------------------------------------------------------------------------------------------------------------
void MyPaint(HDC hdc, LPARAM lParam)
{
int x, y;
char str[20] = "";
x = LOWORD(lParam);//取得鼠标x坐标值
y = HIWORD(lParam);//取得鼠标y坐标值
//设置文本颜色
SetTextColor(hdc, RGB(rand() % 255, rand() % 255, rand() % 255));
//显示文本
TextOut(hdc, 10, 10, "鼠标坐标", strlen("鼠标坐标"));
sprintf(str, "X坐标: %d ", x);
TextOut(hdc, 30, 30, str, strlen(str));
sprintf(str, "Y坐标: %d ", y);
TextOut(hdc, 30, 50, str, strlen(str));
}
如需整体运行框架,请点击: 游戏框架
游戏开发的梦想
梦开始的地方