1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
case WM_LBUTTONDBLCLK: {//
//case WM_RBUTTONDOWN: {
hdcx[n] = BeginPaint(hwnd, &ps);
hdcx[n] = GetDC(hwnd);
//Delete double-clicked circles
for(int i = 0; i < n; i++){
x = LOWORD(lParam);
y = HIWORD(lParam);
DeleteObject(hdcx[i]);
}
RedrawWindow(hwnd, &lprcUpdate, hrgnUpdate, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW);
//Restore other undragged circles
for(int i = 0; i < n; i++){
hdcx[i] = BeginPaint(hwnd, &ps);
hdcx[i] = GetDC(hwnd);
if((x <= X[i]+12 && x >= X[i]-12 && y <= Y[i]+12 && y >= Y[i]-12)){
mybool2[i] = true;
}
else if(mybool2[i] == false){
if(NoteDuration[i] == 1.0){
HBRUSH hbr=CreateSolidBrush(RGB(255,255,255)); /*white brush*/
HBRUSH hOld=(HBRUSH)SelectObject(hdcx[i],hbr);
Ellipse(hdcx[i], X[i], Y[i], X[i]+12, Y[i]+12);
}
else if(NoteDuration[i] == 0.5){
HBRUSH hbr=CreateSolidBrush(RGB(255,255,255)); /*white brush*/
HBRUSH hOld=(HBRUSH)SelectObject(hdcx[i],hbr);
Ellipse(hdcx[i], X[i], Y[i], X[i]+12, Y[i]+12);
MoveToEx(hdcx[i], X[i]+12, Y[i]+6, 0);
LineTo(hdcx[i],X[i]+12, Y[i]-28);
}
else if(NoteDuration[i] == 0.25){
HBRUSH hbr=CreateSolidBrush(RGB(0,0,0)); /*black brush*/
HBRUSH hOld=(HBRUSH)SelectObject(hdcx[i],hbr);
Ellipse(hdcx[i], X[i], Y[i], X[i]+12, Y[i]+12);
MoveToEx(hdcx[i], X[i]+12, Y[i]+6, 0);
LineTo(hdcx[i],X[i]+12, Y[i]-28);
}
}
}
break;
}
|