Click here to Skip to main content
15,892,746 members
Articles / Desktop Programming / MFC

Scroll Window

Rate me:
Please Sign up or sign in to vote.
2.44/5 (13 votes)
23 Mar 2008CPOL3 min read 55.1K   3.2K   20  
A scroll window that surpasses the 16-bit limit and can be hosted by a dialog.
// ChildView.cpp : implementation of the CChildView class
//

#include "stdafx.h"
#include "ScrollWindowTest.h"
#include "ChildView.h"
#include "SystemInformation.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

//extern BOOL _afxGotScrollLines; // defined in wincore.cpp

/////////////////////////////////////////////////////////////////////////////
// CChildView

CChildView::CChildView()
{
}

CChildView::~CChildView()
{
}


BEGIN_MESSAGE_MAP(CChildView,CScrollWindow )
	//{{AFX_MSG_MAP(CChildView)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CChildView

void CChildView::OnDraw(CDC* pDC)
{
    pDC->FillSolidRect(50, 50, 160, 120, RGB(255, 255, 128));
    pDC->Ellipse(50 + 80, 50, 50 + 80 + 160, 50 + 120);
        
    pDC->MoveTo(32767, 50);
    pDC->LineTo(32767, 150);

    pDC->MoveTo(32600, 100);
    pDC->LineTo(32900, 100);
}

/////////////////////////////////////////////////////////////////////////////
// CChildView message handlers

BOOL CChildView::PreCreateWindow(CREATESTRUCT& cs) 
{
	if (!CScrollWindow::PreCreateWindow(cs))
		return FALSE;

	cs.dwExStyle |= WS_EX_CLIENTEDGE;
	cs.style &= ~WS_BORDER;
	cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS, 
		::LoadCursor(NULL, IDC_ARROW), HBRUSH(COLOR_WINDOW+1), NULL);

	return TRUE;
}

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
Unknown
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions