Research Article

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

Algorithm 12

Modeless dialog box: function ModelessDialogProc (part 3).
  98.12case  WM_PAINT:
   99.12   if(vpp.empty())
100.12    break;
101.12   hDC = BeginPaint(hwnd, &ps);
102.12//finding the painting limits:
103.12   iPaintBeg = max(0, yPos + ps.rcPaint.top/yChar - 1);
104.12   iPaintEnd = min(NUMLINES, yPos + ps.rcPaint.bottom/yChar);
105.12   font = CreateFontIndirect(&lf);
106.12   SelectObject(hDC, font);
107.12   SetBkMode(hDC, TRANSPARENT);
108.12   for(int  i = iPaintBeg; i < iPaintEnd; i++)
109.12    y = yChar*(1-iVscrollPos+i);//y- and x-coordinates of
110.12    x = xChar*(1 - xPos);//the beginning of the string
111.12    if(vpp[particleModelessBox].history.size() == 0)
112.12     break;
113.12    if((signed)vpp[particleModelessBox].history.size()<= iPaintBeg)
114.12     break;
115.12    else
116.12     if(i<(signed)vpp[particleModelessBox].history.size())
117.12      temp = sprintf_s(buf,
118.12      "t = 3e y = %.5f z = %.5f vy = %.5f vz = %.5f
119.12      v = %.5f W = %.5f",
120.12      vpp[particleModelessBox].history.at(i).t,
121.12      vpp[particleModelessBox].history.at(i).y,
122.12      vpp[particleModelessBox].history.at(i).z,
123.12      vpp[particleModelessBox].history.at(i).vy,
124.12      vpp[particleModelessBox].history.at(i).vz,
125.12      vpp[particleModelessBox].history.at(i).v,
126.12      vpp[particleModelessBox].history.at(i).W);
127.12      TextOut(hDC, x+10, y, buf, temp); //writing a line of text
128.12              // to the client area from the buffer  temp
129.12     else
130.12      break;
131.12  
132.12   EndPaint(hwnd, &ps);
133.12   break;
134.12case  WM_DESTROY:
136.12   hModelessDlg = 0;
137.12   break;
138.12
139.12return  0;
140.12