COLORREF circle_color = RGB(0, 105, 255); //获取窗口DC HDC hdc = GetDC(hWnd_); //背景色透明 SetBkMode(hdc, TRANSPARENT); // 这里的像素是相对窗体来说的, 而不是屏幕坐标, HPEN pen = CreatePen(PS_SOLID, 3, circle_color); SelectObject(hdc, pen); //Ellipse(hdc, center_x_in_form - CIRCLE_RADIUS, center_y_in_form - CIRCLE_RADIUS, // center_x_in_form + CIRCLE_RADIUS , center_y_in_form + CIRCLE_RADIUS); SetROP2(hdc, R2_NOTXORPEN); // 第一次回圈, 重新调用一次 就 删除原来的圈 去掉这一句就是正常画圈
Ellipse(hdc, center_x_in_form - CIRCLE_RADIUS, center_y_in_form - CIRCLE_RADIUS, center_x_in_form + CIRCLE_RADIUS , center_y_in_form + CIRCLE_RADIUS); //释放句柄DC ReleaseDC(hWnd_, hdc);