1.8 // drawing the particles’ trajectories: |
2.8 SelectObject(hDC, hBluePen); |
3.8 int z1, z2, y1, y2; |
4.8 for(int i = 0; i < (signed)vpp.size(); ++i) |
5.8 for(int j=0; j<(signed)(vpp[i].history.size()-1); ++j) |
6.8 z1 = (int)(mz*vpp[i].history[j].z) + zLeft; |
7.8 y1 = yTop + height2-(int)(my*vpp[i].history[j].y); |
8.8 z2 = (int)(mz*vpp[i].history[j+1].z) + zLeft; |
9.8 y2 = yTop + height2-(int)(my*vpp[i].history[j+1].y); |
10.8 if(y2 > yTop + height) |
11.8 y2 = yTop + height; |
12.8 MoveToEx(hDC, z1, y1, NULL); |
13.8 LineTo(hDC, z2, y2); |
14.8 |
15.8 // showing the number of a particle whose data |
16.8 // will be displayed in the list box: |
17.8 if(particleListBox != -1) |
18.8 pLB = sprintf_s(bufferLB, "%d", particleListBox); |
19.8 SetBkMode(hDC, TRANSPARENT); |
20.8 TextOut(hDC, 720, 60, bufferLB, pLB); |
21.8 |
22.8 EndPaint(hwnd, &psPaint); |
23.8 break; |
24.8 case WM_DESTROY: |
25.8 DeleteObject(g_hbrBackground); |
26.8 DeleteObject(hBlackBrush); |
27.8 DeleteObject(hBlackPen); |
28.8 DeleteObject(hPinkPen); |
29.8 DeleteObject(hBluePen); |
30.8 DeleteObject(hGreyPen); |
31.8 DeleteObject(hWhitePen); |
32.8 DeleteObject(hBlackThickPen); |
33.8 PostQuitMessage(0); |
34.8 break; |
35.8 |
36.8 return 0; |
37.8 |