Research Article

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

Algorithm 7

Modal dialog box: function ModalDlgProc (part 3).
1.7// drawing the caption:
  2.7SetBkMode(hDC, TRANSPARENT);
  3.7fontCaption = CreateFontIndirect(&lf2);
  4.7SelectObject(hDC, fontCaption);
  5.7TextOut(hDC, 130, 20, caption, strlen(caption));
  6.7// drawing the plot rectangle:
  7.7SelectObject(hDC, hWhitePen);
  8.7Rectangle(hDC, zLeft, yTop-4, zLeft+width, yTop+height+4);
  9.7// drawing the Z-axis with an arrow head:
10.7SelectObject(hDC, hBlackPen);
11.7MoveToEx(hDC, zLeft, yTop + height2, NULL);
12.7LineTo(hDC, zLeft + width + 15, yTop + height2);
13.7LineTo(hDC, zLeft + width + 10, yTop + height2 -2);
14.7MoveToEx(hDC, zLeft + width + 15, yTop + height2, NULL);
15.7LineTo(hDC, zLeft + width + 10, yTop + height2 +2);
16.7// drawing the horizontal grey gridlines:
17.7SelectObject(hDC, hGreyPen);
18.7MoveToEx(hDC, zLeft, yTop + height2*2/3, NULL);
19.7LineTo(hDC, zLeft + width, yTop + height2*2/3);
20.7MoveToEx(hDC, zLeft, yTop + height2/3, NULL);
21.7LineTo(hDC, zLeft + width, yTop + height2/3);
22.7MoveToEx(hDC, zLeft, yTop + height2*4/3, NULL);
23.7LineTo(hDC, zLeft + width, yTop + height2*4/3);
24.7MoveToEx(hDC, zLeft, yTop + height2*5/3, NULL);
25.7LineTo(hDC, zLeft + width, yTop + height2*5/3);
26.7// drawing the horizontal black axis with tick marks:
27.7SelectObject(hDC, hBlackPen);
28.7MoveToEx(hDC, zLeft, yTop + height + 25, NULL);
29.7LineTo(hDC, zLeft + width, yTop + height + 25);
30.7// drawing the y-axis with an arrow head:
31.7MoveToEx(hDC, zLeft, yTop + height + 25, NULL);
32.7LineTo(hDC, zLeft, yTop - 15);
33.7LineTo(hDC, zLeft - 2, yTop - 10);
34.7MoveToEx(hDC, zLeft, yTop - 15, NULL);
35.7LineTo(hDC, zLeft + 2, yTop - 10);
36.7// drawing the vertical grey gridlines:
37.7SelectObject(hDC, hGreyPen);
38.7for(int  i = 1; i <= 11; ++i)
39.7MoveToEx(hDC, zLeft+(int)(0.01*mz*i), yTop+height, NULL);
40.7LineTo(hDC, zLeft + (int)(0.01*mz*i), yTop-1);
41.7
42.7// drawing the electrodes:
43.7SelectObject(hDC, hBlackBrush);
44.7Rectangle(hDC,zLeft,yTop-4,zLeft+(int)(12.7*kzy*mz),yTop);
45.7Rectangle(hDC, zLeft + (int)((28.0-12.7)*kzy*mz), yTop-4,
46.7                      zLeft + width, yTop);
47.7Rectangle(hDC, zLeft, yTop+height, zLeft + (int)(12.7*kzy*mz),
48.7                      yTop + height + 4);
49.7Rectangle(hDC, zLeft+ (int)((28.0-12.7)*kzy*mz), yTop+height,
50.7                zLeft + width, yTop + height + 4);
51.7// drawing the equipotential lines and labels of potentials:
52.7SelectObject(hDC, hPinkPen);
53.7DrawEquipotentialLines(hDC, fontPotential, lf, hBlackPen,
54.7                            Particle::pF);