// DepthView.cpp : implementation file
//

#include "stdafx.h"
#include "6046dryend.h"
#include "DepthView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDepthView

IMPLEMENT_DYNCREATE(CDepthView, CView)

CDepthView::CDepthView()
{
	m_hBmpDisplay = LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_DEPTH_DISPLAY));
	m_bmpDisplay  = display.FromHandle(m_hBmpDisplay);
	m_bmpDisplay->GetBitmap(&m_bmpInfo);
}

CDepthView::~CDepthView()
{
}


BEGIN_MESSAGE_MAP(CDepthView, CView)
	//{{AFX_MSG_MAP(CDepthView)
	ON_WM_PAINT()
	ON_WM_CREATE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDepthView drawing

void CDepthView::OnDraw(CDC* pDC)
{
	CDocument* pDoc = GetDocument();
	// TODO: add draw code here
}

/////////////////////////////////////////////////////////////////////////////
// CDepthView diagnostics

#ifdef _DEBUG
void CDepthView::AssertValid() const
{
	CView::AssertValid();
}

void CDepthView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CDepthView message handlers

void CDepthView::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	CRect rect;
	GetClientRect(&rect);

	m_pDC->StretchBlt(rect.TopLeft().x, rect.TopLeft().y, rect.Width(), rect.Height(),
		              &m_dcDisplay, 0,0, m_bmpInfo.bmWidth, m_bmpInfo.bmHeight, SRCCOPY); 

	
	// Do not call CView::OnPaint() for painting messages
}

int CDepthView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CView::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	m_pDC = this->GetDC();
	m_dcDisplay.CreateCompatibleDC(m_pDC);
	m_dcDisplay.SelectObject(*m_bmpDisplay);

	//m_penAxis.CreatePen(PS_JOIN_BEVEL,1, RGB(255,255,255));
	
	return 0;
}
