Click here to Skip to main content
15,885,546 members
Articles / Desktop Programming / MFC

Implementing Rulers inside of Splitter Panes - 2

Rate me:
Please Sign up or sign in to vote.
4.59/5 (15 votes)
18 Dec 2002CPOL 108.8K   3.4K   54  
Using fixed panes to add rulers to your view
// DemoView.h : interface of the CDemoView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_DEMOVIEW_H__F1FEFA94_FEA9_45FD_BAC3_167A0805B5DA__INCLUDED_)
#define AFX_DEMOVIEW_H__F1FEFA94_FEA9_45FD_BAC3_167A0805B5DA__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CChildFrame;

class CDemoView : public CScrollView
{
protected: // create from serialization only
	CDemoView();
	DECLARE_DYNCREATE(CDemoView)

// Attributes
public:
	CDemoDoc* GetDocument();

private:
    CChildFrame* m_pParent;
    CBitmap      m_Bitmap;
    CBrush       m_BrushBackGround;

    CPoint       m_RefScroll;
	CPoint       m_RefPoint;
    CSize        m_ImageSize;
    BOOL         m_bMoveImage;
    float 	     m_fZoomFactor;
    BOOL         m_bShowRulers;

// Operations
private:
    void     UpdateRulersInfo(int nMessage, CPoint ScrollPos, CPoint Pos = CPoint(0, 0)); 

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CDemoView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual void OnInitialUpdate();
	protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CDemoView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CDemoView)
	afx_msg void OnRulersTogglerulers();
	afx_msg void OnUpdateRulersTogglerulers(CCmdUI* pCmdUI);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnDemoZoomin();
	afx_msg void OnUpdateDemoZoomin(CCmdUI* pCmdUI);
	afx_msg void OnDemoZomm11();
	afx_msg void OnUpdateDemoZomm11(CCmdUI* pCmdUI);
	afx_msg void OnDemoZoomout();
	afx_msg void OnUpdateDemoZoomout(CCmdUI* pCmdUI);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnDemoMoveimage();
	afx_msg void OnUpdateDemoMoveimage(CCmdUI* pCmdUI);
	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in DemoView.cpp
inline CDemoDoc* CDemoView::GetDocument()
   { return (CDemoDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_DEMOVIEW_H__F1FEFA94_FEA9_45FD_BAC3_167A0805B5DA__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
CEO
Canada Canada

Comments and Discussions