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

📄 fvwangluotu.cpp

📁 我自己整理的一些VC源代码
💻 CPP
字号:
// FVWangluotu.cpp : implementation file
//

#include "stdafx.h"
#include "SellMan.h"
#include "FVWangluotu.h"

#include "TreeNode.h"

#include "TabXC.h"
#include "TabDL.h"
#include "TabSJ.h"
#include "TabSP.h"
#include "TabCS.h"

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

/////////////////////////////////////////////////////////////////////////////
// CFVWangluotu

extern _ConnectionPtr connection;
extern BOOL bConnected;

IMPLEMENT_DYNCREATE(CFVWangluotu, CFormView)

CFVWangluotu::CFVWangluotu()
	: CFormView(CFVWangluotu::IDD)
{
	//{{AFX_DATA_INIT(CFVWangluotu)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	m_bFirstTime        = TRUE;
}

CFVWangluotu::~CFVWangluotu()
{
}

void CFVWangluotu::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CFVWangluotu)
	DDX_Control(pDX, IDC_TREE_XC, m_tree_xc);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CFVWangluotu, CFormView)
	//{{AFX_MSG_MAP(CFVWangluotu)
	ON_WM_SIZE()
	ON_WM_DESTROY()
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, OnFilePrintPreview)
	//}}AFX_MSG_MAP
	ON_COMMAND(ID_FILE_PRINT, CFormView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CFormView::OnFilePrint)
	//ON_COMMAND(ID_FILE_PRINT_PREVIEW, CFormView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFVWangluotu diagnostics

#ifdef _DEBUG
void CFVWangluotu::AssertValid() const
{
	CFormView::AssertValid();
}

void CFVWangluotu::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CFVWangluotu message handlers

void CFVWangluotu::OnInitialUpdate() 
{
	CFormView::OnInitialUpdate();
	
	SetScrollSizes( MM_TEXT, CSize( 0, 0 ) );

	HICON hIcon;
	m_imgListsm.Create (16, 16, true, 2, 1);
	hIcon= AfxGetApp()->LoadIcon( IDI_MAN );
	m_imgListsm.Add(hIcon);
	m_tree_xc.SetImageList( &m_imgListsm, TVSIL_NORMAL );
	//m_tree_xc.SetTextColor( RGB( 0, 0, 162 ) );

	m_tree_xc.InitImageList( & m_imgListsm);

	//ImportXC();
}

void CFVWangluotu::OnSize(UINT nType, int cx, int cy) 
{
	CFormView::OnSize(nType, cx, cy);
	
	if( m_tree_xc.GetSafeHwnd() )
	{
		m_tree_xc.SetWindowPos( 0, 0, 0, cx, cy, SWP_NOZORDER );
	}
}

void CFVWangluotu::ImportXC(LPCTSTR strCode)
{
	CTwoForkTree twoTree;
	twoTree.ImportPlugger();

	//twoTree.Contraction();
	twoTree.ToTreeCtrl( &m_tree_xc );
}

void CFVWangluotu::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView) 
{
	AfxGetApp()->GetMainWnd()->SendMessage( WM_VIEW_ACTIVE, (WPARAM)this, (LPARAM)this );
	
	CFormView::OnActivateView(bActivate, pActivateView, pDeactiveView);
}

void CFVWangluotu::OnDestroy() 
{
	CFormView::OnDestroy();
	
	AfxGetApp()->GetMainWnd()->SendMessage( WM_VIEW_CLOSE, (WPARAM)this, (LPARAM)this );
}

BOOL CFVWangluotu::OnPreparePrinting(CPrintInfo* pInfo) 
{
	// TODO: call DoPreparePrinting to invoke the Print dialog box
	
	return DoPreparePrinting(pInfo);
}

void CFVWangluotu::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo) 
{
	m_bFirstTime                   = TRUE;
    m_tree_xc.m_bContinuePrinting  = TRUE;

    // Fill the DIB-Array
    m_tree_xc.CreateDibArrays();
}

void CFVWangluotu::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo) 
{
	m_bFirstTime                   = TRUE;
    m_tree_xc.m_bContinuePrinting  = TRUE;

    // Empty the DIB-Array
    m_tree_xc.DeleteDibArrays();
}

void CFVWangluotu::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo) 
{
	CFormView::OnPrepareDC(pDC, pInfo);

    // Stop Printing
    if( NULL != pInfo )
    {
        if( FALSE == pInfo->m_bPreview )
        {
            // Set the Continueflag
            pInfo->m_bContinuePrinting = m_tree_xc.m_bContinuePrinting;	
        }
    }
}

void CFVWangluotu::OnPrint(CDC* pDC, CPrintInfo* pInfo) 
{
	// Define the Originmapping of the viewport and 
    // the window for Footer and Header
    int iSavedPageStart = pInfo->m_rectDraw.top;
    pDC->SetWindowOrg( 0,  0 );
    pDC->SetViewportOrg( pInfo->m_rectDraw.left,  -iSavedPageStart );

    // Print the Page
        // Get the View-DC
        CDC* pViewDC = GetDC();

        // Set the Mappingmode
        pDC->SetMapMode(MM_ANISOTROPIC);

        // Define the Originmapping of the viewport and 
        // the window for Treeoutput
        pDC->SetWindowOrg( 0,  0 );
        pDC->SetViewportOrg( pInfo->m_rectDraw.left,  pInfo->m_rectDraw.top - iSavedPageStart );

        // Define the Extentmapping of the viewport and the Window
        pDC->SetViewportExt( pDC->GetDeviceCaps(LOGPIXELSX)
						    ,pDC->GetDeviceCaps(LOGPIXELSY) );

        pDC->SetWindowExt( pViewDC->GetDeviceCaps(LOGPIXELSX)
					      ,pViewDC->GetDeviceCaps(LOGPIXELSY) );

        // Release the View-DC
        ReleaseDC(pViewDC);

        if( TRUE == m_bFirstTime )
        {    
            // Draw the Tree to the Printer-DC
            m_tree_xc.MakePaging( pDC, pInfo );

            m_bFirstTime = FALSE;
        }

        // Draw the Tree to the Printer-DC
        m_tree_xc.DrawTreeCtrl( pDC, pInfo );
}

void CFVWangluotu::OnFilePrintPreview() 
{
	CFormView::OnFilePrintPreview();
}

void CFVWangluotu::ImportWangLuoTu(long lSequence)
{
	CTwoForkTree twoTree;
	twoTree.ImportPlugger();

	twoTree.ToTreeCtrl( &m_tree_xc, lSequence );
}

⌨️ 快捷键说明

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