Research Article

Development of the Object-Oriented Dynamic Simulation Models Using Visual C++ Freeware

Algorithm 8

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