REPORTWND.CPP
上传用户:lvjun8202
上传日期:2013-04-30
资源大小:797k
文件大小:3k
- // ReportWnd.cpp : implementation file
- //
- #include "stdafx.h"
- #include "OAM.h"
- #include "ReportWnd.h"
- #include "OutputReport.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CReportWnd
- CReportWnd::CReportWnd()
- {
- }
- CReportWnd::~CReportWnd()
- {
- }
- BEGIN_MESSAGE_MAP(CReportWnd, CWnd)
- //{{AFX_MSG_MAP(CReportWnd)
- ON_WM_NCCALCSIZE()
- ON_WM_CREATE()
- //}}AFX_MSG_MAP
- ON_MESSAGE(SM_PAGECHANGED,OnPageChanged)
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CReportWnd message handlers
- void CReportWnd::ActivateScrollBar()
- {
- if(!m_wndSheet.GetSafeHwnd())
- return;
- int min = 0;
- int max = 1024;
- int page = 10;
- COutputReport * pWnd = (COutputReport *)m_wndSheet.GetActiveView();
- if(pWnd && pWnd->GetSafeHwnd())
- {
- max = pWnd->GetHScrollRange();
- }
- // BOOL bShow = NeedScroll();
- m_wndSheet.ShowScrollBar(max>0);
- if (max>0)
- {
- /* CRect rect; pWnd->GetClientRect(rect);
- SCROLLINFO scrollInfor;
- scrollInfor.nPage = rect.Width();
- scrollInfor.nMin = 0;
- scrollInfor.nMax = max+100;
- scrollInfor.fMask = SIF_RANGE;
- m_wndSheet.GetScrollBar().SetScrollInfo( &scrollInfor);
- */ m_wndSheet.GetScrollBar().SetScrollRange(min, max);
- }
- }
- BOOL CReportWnd::NeedScroll()
- {
- CRect rect; GetClientRect(rect);
- return TRUE;//rect.Width() < SumWidthColumns() - 1;
- }
- void CReportWnd::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp)
- {
- // TODO: Add your message handler code here and/or call default
- if(m_wndSheet.GetSafeHwnd())
- {
- CWnd * pWnd = m_wndSheet.GetActiveView();
- // if(pWnd && pWnd->GetSafeHwnd())
- // pWnd->ModifyStyle(WS_HSCROLL, 0);//, SWP_NOREDRAW | SWP_NOSENDCHANGING);
- }
- ModifyStyle(WS_HSCROLL, 0, SWP_NOREDRAW | SWP_NOSENDCHANGING);
- CWnd::OnNcCalcSize(bCalcValidRects, lpncsp);
- ActivateScrollBar();
- }
- int CReportWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
- {
- if (CWnd::OnCreate(lpCreateStruct) == -1)
- return -1;
-
- // TODO: Add your specialized creation code here
- if (!m_wndSheet.GetSafeHwnd())
- {
- ModifyStyle(0, WS_CLIPCHILDREN);
- m_wndSheet.Attach(this);
- m_wndSheet.SetWindowPos(&CWnd::wndTop,0,0,0,0, SWP_NOSIZE | SWP_NOMOVE);
- }
-
- return 0;
- }
- BOOL CReportWnd::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
- {
- // TODO: Add your specialized code here and/or call the base class
- ActivateScrollBar();
-
- return CWnd::OnNotify(wParam, lParam, pResult);
- }
- LRESULT CReportWnd::OnPageChanged(WPARAM pNewView, LPARAM)
- {
- if(pNewView)
- {
- ;//ActivateScrollBar();
- }
- return TRUE;
- }