www.pudn.com > seedesk.zip > ClientView.cpp


// ClientView.cpp : implementation file 
// 
/*************************************************************************** 
 *        Module               :                             * 
 *         
 *                                                                         * 
 *        Created by           : ??      Date  : 2004.9.12        * 
 *        Modified by          :                  Date  :                  * 
 *                                                                         *  
 *                   *  
 ***************************************************************************/ 
#include "stdafx.h" 
#include "BossSeeClient.h" 
#include "ClientView.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
extern BITMAP btm; 
extern char* lpData; 
///////////////////////////////////////////////////////////////////////////// 
// CClientView 
 
IMPLEMENT_DYNCREATE(CClientView, CView) 
 
CClientView::CClientView() 
{ 
} 
 
CClientView::~CClientView() 
{ 
} 
 
 
BEGIN_MESSAGE_MAP(CClientView, CView) 
	//{{AFX_MSG_MAP(CClientView) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CClientView drawing 
 
void CClientView::OnDraw(CDC* pDC) 
{//显示接收到的位图信息 
	CDocument* pDoc = GetDocument(); 
	// TODO: add draw code here 
	if(lpData==NULL) return; 
	BITMAP myBITMAP; 
	myBITMAP.bmBits=btm.bmBits; 
    myBITMAP.bmBitsPixel=btm.bmBitsPixel; 
	myBITMAP.bmHeight=btm.bmHeight; 
	myBITMAP.bmPlanes=btm.bmPlanes; 
	myBITMAP.bmType=btm.bmType; 
	myBITMAP.bmWidth=btm.bmWidth; 
    myBITMAP.bmWidthBytes=btm.bmWidthBytes; 
	BITMAPINFOHEADER bih; 
	bih.biBitCount=myBITMAP.bmBitsPixel; 
	bih.biClrImportant=0; 
	bih.biClrUsed=0; 
	bih.biCompression=0; 
	bih.biHeight=myBITMAP.bmHeight; 
	bih.biPlanes=1; 
	bih.biSize=sizeof(BITMAPINFOHEADER); 
	bih.biSizeImage=myBITMAP.bmWidthBytes*myBITMAP.bmHeight; 
	bih.biWidth=myBITMAP.bmWidth; 
	bih.biXPelsPerMeter=0; 
	bih.biYPelsPerMeter=0; 
		///////////////////////// 
			CBitmap tbitmap; 
	if(tbitmap.CreateBitmapIndirect(&myBITMAP)==NULL)  
	   MessageBox("b mull"); 
 
	if(tbitmap.m_hObject==NULL)MessageBox("NULL"); 
	 
	 
 //  CPaintDC tdc(this); 
   CDC tmemdc;  
	tmemdc.CreateCompatibleDC(pDC); 
	SetDIBits(tmemdc.m_hDC,tbitmap,0,btm.bmHeight,lpData,(BITMAPINFO*)&bih,DIB_RGB_COLORS); 
	CRect trect; 
	GetClientRect(&trect); 
	 
    
   CBitmap* lpOldbit=tmemdc.SelectObject(&tbitmap); 
   pDC->StretchBlt(0,0,trect.Width(),trect.Height(),&tmemdc,0,0,myBITMAP.bmWidth,myBITMAP.bmHeight,SRCCOPY); 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CClientView diagnostics 
 
#ifdef _DEBUG 
void CClientView::AssertValid() const 
{ 
	CView::AssertValid(); 
} 
 
void CClientView::Dump(CDumpContext& dc) const 
{ 
	CView::Dump(dc); 
} 
#endif //_DEBUG 
 
///////////////////////////////////////////////////////////////////////////// 
// CClientView message handlers