| 223 | // this is automatically done for you by the framework. |
| 224 | |
| 225 | void CAdapterVisualDlg::OnPaint() |
| 226 | { |
| 227 | CPaintDC dc(this); // device context for painting |
| 228 | |
| 229 | if (IsIconic()) |
| 230 | { |
| 231 | SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0); |
| 232 | |
| 233 | // Center icon in client rectangle |
| 234 | int cxIcon = GetSystemMetrics(SM_CXICON); |
| 235 | int cyIcon = GetSystemMetrics(SM_CYICON); |
| 236 | CRect rect; |
| 237 | GetClientRect(&rect); |
| 238 | int x = (rect.Width() - cxIcon + 1) / 2; |
| 239 | int y = (rect.Height() - cyIcon + 1) / 2; |
| 240 | |
| 241 | // Draw the icon |
| 242 | dc.DrawIcon(x, y, m_hIcon); |
| 243 | } |
| 244 | else |
| 245 | { |
| 246 | for (auto& o : vectorObjects) |
| 247 | { |
| 248 | for (auto& l : *o) |
| 249 | { |
| 250 | LineToPointCachingAdapter lpo{ l }; |
| 251 | DrawPoints(dc, lpo.begin(), lpo.end()); |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | CDialogEx::OnPaint(); |
| 256 | } |
| 257 | |
| 258 | } |
| 259 | |
| 260 | // The system calls this function to obtain the cursor to display while the user drags |
| 261 | // the minimized window. |