////////////////// // Get min/max info. // void CWinMgr::GetMinMaxInfo(CWnd* pWnd, MINMAXINFO* lpMMI) { SIZEINFO szi; GetMinMaxInfo(pWnd, szi); // call overloaded version lpMMI->ptMinTrackSize = CPoint(szi.szMin); lpMMI->ptMaxTrackSize = CPoint(szi.szMax); }
// 准备缓冲区 BOOL CTechnique::PrepareCache( int nStart, int nEnd, BOOL bForceRecalculate ) { SP_ASSERT( m_pKData ); if( NULL == m_pKData ) return FALSE; if( -1 == nEnd ) nEnd = m_pKData->GetSize()-1; if( nStart < 0 || nEnd < nStart || nEnd >= m_pKData->GetSize() ) return FALSE; if( bForceRecalculate ) Clear( ); return GetMinMaxInfo( nStart, nEnd, NULL, NULL ); }
// 准备数据,得到较大值和较小值 BOOL CTechnique::IntensityPrepare( int nIndex, UINT * pnCode, int nMaxDays, int nMinMaxDays, double *pdLiminalLow, double *pdLiminalHigh, double dGateLow, double dGateHigh ) { if( pnCode ) *pnCode = ITSC_NOTHING; if( nIndex < nMaxDays + nMinMaxDays ) return FALSE; int nStart = nIndex - nMinMaxDays + 1; if( nStart < 0 ) return FALSE; double dMin = 0, dMax = 0; if( !GetMinMaxInfo( nStart, nIndex, &dMin, &dMax ) ) return FALSE; if( pdLiminalLow ) *pdLiminalLow = dMin + (dMax-dMin)*dGateLow; if( pdLiminalHigh ) *pdLiminalHigh = dMin + (dMax-dMin)*dGateHigh; return TRUE; }
void CXTPDockingPaneSidePanel::OnNcLButtonDown(UINT nHitTest, CPoint point) { if (nHitTest >= HTSIZEFIRST && nHitTest <= HTSIZELAST) { _RestoreFocus(); Expand(); SetCapture(); m_pLayout->MoveToTail(this); CXTPWindowRect rcWindow(this); CRect rcClient(GetDockingPaneManager()->GetClientPane()->GetPaneWindowRect()); rcClient.DeflateRect(GetDockingPaneManager()->GetSideDockingMargin()); rcWindow.OffsetRect(-rcClient.TopLeft()); MINMAXINFO mmi; GetMinMaxInfo(&mmi); BOOL bResizeTop = nHitTest == HTTOP || nHitTest == HTTOPLEFT || nHitTest == HTTOPRIGHT; BOOL bResizeBottom = nHitTest == HTBOTTOM || nHitTest == HTBOTTOMLEFT || nHitTest == HTBOTTOMRIGHT; BOOL bResizeRight = nHitTest == HTRIGHT || nHitTest == HTTOPRIGHT || nHitTest == HTBOTTOMRIGHT; BOOL bResizeLeft = nHitTest == HTLEFT || nHitTest == HTTOPLEFT || nHitTest == HTBOTTOMLEFT; while (::GetCapture() == m_hWnd) { MSG msg; if (!GetMessage(&msg, NULL, 0, 0)) break; if (msg.message == WM_MOUSEMOVE) { CPoint pt = CPoint(msg.lParam); ClientToScreen(&pt); CPoint ptOffset = pt - point; point = pt; if (bResizeTop) rcWindow.top += ptOffset.y; if (bResizeBottom) rcWindow.bottom += ptOffset.y; if (bResizeRight) rcWindow.right += ptOffset.x; if (bResizeLeft) rcWindow.left += ptOffset.x; m_rcWindow = rcWindow; if (m_rcWindow.Height() > mmi.ptMaxTrackSize.y) { if (bResizeTop) m_rcWindow.top = m_rcWindow.bottom - mmi.ptMaxTrackSize.y; else m_rcWindow.bottom = m_rcWindow.top + mmi.ptMaxTrackSize.y; } if (m_rcWindow.Height() < mmi.ptMinTrackSize.y) { if (bResizeTop) m_rcWindow.top = m_rcWindow.bottom - mmi.ptMinTrackSize.y; else m_rcWindow.bottom = m_rcWindow.top + mmi.ptMinTrackSize.y; } if (m_rcWindow.Width() > mmi.ptMaxTrackSize.x) { if (bResizeLeft) m_rcWindow.left = m_rcWindow.right - mmi.ptMaxTrackSize.x; else m_rcWindow.right = m_rcWindow.left + mmi.ptMaxTrackSize.x; } if (m_rcWindow.Width() < mmi.ptMinTrackSize.x) { if (bResizeLeft) m_rcWindow.left = m_rcWindow.right - mmi.ptMinTrackSize.x; else m_rcWindow.right = m_rcWindow.left + mmi.ptMinTrackSize.x; } RecalcLayout(FALSE); } else if (msg.message == WM_KEYDOWN && msg.wParam == VK_ESCAPE) break; else if (msg.message == WM_LBUTTONUP) break; else ::DispatchMessage(&msg); } if (CWnd::GetCapture() == this) ReleaseCapture(); } }