| 575 | // right corners of the window may change depending on the scroll position. |
| 576 | |
| 577 | void ResizeWindowToChart() |
| 578 | { |
| 579 | HDC hdc; |
| 580 | RECT rcOld, rcCli, rcNew; |
| 581 | int xScr, yScr; |
| 582 | |
| 583 | if (!us.fGraphics) |
| 584 | return; |
| 585 | if (gs.xWin == 0) |
| 586 | gs.xWin = DEFAULTX; |
| 587 | if (gs.yWin == 0) |
| 588 | gs.yWin = DEFAULTY; |
| 589 | hdc = GetDC(wi.hwnd); |
| 590 | xScr = GetDeviceCaps(hdc, HORZRES); |
| 591 | yScr = GetDeviceCaps(hdc, VERTRES); |
| 592 | ReleaseDC(wi.hwnd, hdc); |
| 593 | GetWindowRect(wi.hwnd, &rcOld); |
| 594 | GetClientRect(wi.hwnd, &rcCli); |
| 595 | rcNew.left = rcOld.left + gi.xOffset; |
| 596 | rcNew.top = rcOld.top + gi.yOffset; |
| 597 | rcNew.right = rcNew.left + gs.xWin + (gi.nMode == 0 ? (SIDESIZE * |
| 598 | gi.nScaleText) >> 1 : 0) + (rcOld.right - rcOld.left - rcCli.right); |
| 599 | rcNew.bottom = rcNew.top + gs.yWin + |
| 600 | (rcOld.bottom - rcOld.top - rcCli.bottom); |
| 601 | if (rcNew.right > xScr) |
| 602 | OffsetRect(&rcNew, xScr - rcNew.right, 0); |
| 603 | if (rcNew.bottom > yScr) |
| 604 | OffsetRect(&rcNew, 0, yScr - rcNew.bottom); |
| 605 | if (rcNew.left < 0) |
| 606 | OffsetRect(&rcNew, -rcNew.left, 0); |
| 607 | if (rcNew.top < 0) |
| 608 | OffsetRect(&rcNew, 0, -rcNew.top); |
| 609 | wi.fNotManual = fTrue; |
| 610 | MoveWindow(wi.hwnd, rcNew.left, rcNew.top, |
| 611 | rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, fTrue); |
| 612 | wi.fNotManual = fFalse; |
| 613 | } |
| 614 | #endif |
| 615 | |
| 616 |
no outgoing calls
no test coverage detected