up

解决方案 »

  1.   

    可以啊!采用光栅操作,用下面这个函数:
    SetROP2
    The SetROP2 function sets the current foreground mix mode. GDI uses the foreground mix mode to combine pens and interiors of filled objects with the colors already on the screen. The foreground mix mode defines how colors from the brush or pen and the colors in the existing image are to be combined. int SetROP2(
      HDC hdc,         // handle to DC
      int fnDrawMode   // drawing mode
    );
    用异或方式(R2_XORPEN)来画,画一个矩形,再在原地画同样的矩形,矩形就消失了,而且不会破坏背景,然后再在下一个地方画矩形,就好像移动了,代码可以写在WM_KEYDOWN下,通过判断wParam 中的虚拟键码来响应方向键