⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 afxtemp.000

📁 讲mfc的书
💻 000
字号:
class CPreviewView : public CScrollView
{
        DECLARE_DYNCREATE(CPreviewView)

// Constructors
public:
        CPreviewView();
        BOOL SetPrintView(CView* pPrintView);

// Attributes
protected:
        CView* m_pOrigView;
        CView* m_pPrintView;
        CPreviewDC* m_pPreviewDC;  // Output and attrib DCs Set, not created
        CDC m_dcPrint;             // Actual printer DC

// Operations
        void SetZoomState(UINT nNewState, UINT nPage, CPoint point);
        void SetCurrentPage(UINT nPage, BOOL bClearRatios);

        // Returns TRUE if in a page rect. Returns the page index
        // in nPage and the point converted to 1:1 screen device coordinates
        BOOL FindPageRect(CPoint& point, UINT& nPage);


// Overridables
        virtual void OnActivateView(BOOL bActivate,
                        CView* pActivateView, CView* pDeactiveView);

        // Returns .cx/.cy as the numerator/denominator pair for the ratio
        // using CSize for convenience
        virtual CSize CalcScaleRatio(CSize windowSize, CSize actualSize);

        virtual void PositionPage(UINT nPage);
        virtual void OnDisplayPageNumber(UINT nPage, UINT nPagesDisplayed);

// Implementation
public:
        virtual ~CPreviewView();
        virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL);
#ifdef _DEBUG
        void AssertValid() const;
        void Dump(CDumpContext& dc) const;
#endif
#ifdef _MAC
        virtual void CalcWindowRect(LPRECT lpClientRect);
#endif

protected:
        //{{AFX_MSG(CPreviewView)
        afx_msg void OnPreviewClose();
        afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
        afx_msg void OnSize(UINT nType, int cx, int cy);
        afx_msg void OnDraw(CDC* pDC);
        afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
        afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
        afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
        afx_msg BOOL OnEraseBkgnd(CDC* pDC);
        afx_msg void OnNumPageChange();
        afx_msg void OnNextPage();
        afx_msg void OnPrevPage();
        afx_msg void OnPreviewPrint();
        afx_msg void OnZoomIn();
        afx_msg void OnZoomOut();
        afx_msg void OnUpdateNumPageChange(CCmdUI* pCmdUI);
        afx_msg void OnUpdateNextPage(CCmdUI* pCmdUI);
        afx_msg void OnUpdatePrevPage(CCmdUI* pCmdUI);
        afx_msg void OnUpdateZoomIn(CCmdUI* pCmdUI);
        afx_msg void OnUpdateZoomOut(CCmdUI* pCmdUI);
        afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
        //}}AFX_MSG

        void DoZoom(UINT nPage, CPoint point);
        void SetScaledSize(UINT nPage);
        CSize CalcPageDisplaySize();

        CPrintPreviewState* m_pPreviewState; // State to restore
        CDialogBar* m_pToolBar; // Toolbar for preview

        struct PAGE_INFO
        {
                CRect rectScreen; // screen rect (screen device units)
                CSize sizeUnscaled; // unscaled screen rect (screen device units)
                CSize sizeScaleRatio; // scale ratio (cx/cy)
                CSize sizeZoomOutRatio; // scale ratio when zoomed out (cx/cy)
        };

        PAGE_INFO* m_pPageInfo; // Array of page info structures
        PAGE_INFO m_pageInfoArray[2]; // Embedded array for the default implementation

        BOOL m_bPageNumDisplayed;// Flags whether or not page number has yet
                                                                // been displayed on status line
        UINT m_nZoomOutPages; // number of pages when zoomed out
        UINT m_nZoomState;
        UINT m_nMaxPages; // for sanity checks
        UINT m_nCurrentPage;
        UINT m_nPages;
        int m_nSecondPageOffset; // used to shift second page position

        HCURSOR m_hMagnifyCursor;

        CSize m_sizePrinterPPI; // printer pixels per inch
        CPoint m_ptCenterPoint;
        CPrintInfo* m_pPreviewInfo;

        DECLARE_MESSAGE_MAP()

        friend class CView;
        friend BOOL CALLBACK _AfxPreviewCloseProc(CFrameWnd* pFrameWnd);
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -