cfximpexp.cpp

来自「Delphi Component - Chart Fx」· C++ 代码 · 共 129 行

CPP
129
字号
// CfxImpExp.cpp : implementation file
//

#include "stdafx.h"
#include "cfx98.h"
#include "CfxImpExp.h"

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

/////////////////////////////////////////////////////////////////////////////
// CCfxImpExp dialog


CCfxImpExp::CCfxImpExp(CWnd* pParent /*=NULL*/)
	: CDialog(CCfxImpExp::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCfxImpExp)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CCfxImpExp::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCfxImpExp)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP

	// ***CFX***
	// Do not use class wizard to generate these. It will cause the generation of unecesary classes
	DDX_Control(pDX, IDC_CHART1, m_ChartFX);
	if (!pDX->m_bSaveAndValidate) // Link Chart FX pointer to control window
		m_pChartFX = m_ChartFX.GetControlUnknown();
	// ***CFX***

}


BEGIN_MESSAGE_MAP(CCfxImpExp, CDialog)
	//{{AFX_MSG_MAP(CCfxImpExp)
	ON_WM_DESTROY()
	ON_BN_CLICKED(IDC_EXPTOFILE, OnExptofile)
	ON_BN_CLICKED(IDC_CHANGES, OnChanges)
	ON_BN_CLICKED(IDC_IMPFROMFILE, OnImpfromfile)
	ON_BN_CLICKED(IDC_EXPPICTURE, OnExppicture)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCfxImpExp message handlers

void CCfxImpExp::OnDestroy() 
{
	
	m_pChartFX = NULL;

	CDialog::OnDestroy();

	
	
	// TODO: Add your message handler code here
	
}

void CCfxImpExp::OnExptofile() 
{
	// TODO: Add your control notification handler code here
    m_pChartFX->Export(CHART_CFXOLEFILE, "Chart.chd");

	GetDlgItem(IDC_CHANGES)->EnableWindow(TRUE);
    
    
	
}

void CCfxImpExp::OnChanges() 
{
	// TODO: Add your control notification handler code here
	m_pChartFX->Gallery = AREA;
    m_pChartFX->Palette = "Dark Pastels";
    m_pChartFX->ToolBar = FALSE;
	GetDlgItem(IDC_IMPFROMFILE)->EnableWindow(TRUE);
    

	
}

void CCfxImpExp::OnImpfromfile() 
{
	// TODO: Add your control notification handler code here
	char buffer[50],s[]="\\chart.chd";
	int j;
	j=GetCurrentDirectory(50, buffer);
    sprintf(buffer+j, "%s", s);
	HRESULT hr = m_pChartFX->Import(CHART_CFXOLEFILE, buffer);
	
}

void CCfxImpExp::OnExppicture() 
{
	// TODO: Add your control notification handler code here


	GetDlgItem(IDC_PICTURE)->GetWindowRect(&m_PictureRect);
	ScreenToClient(m_PictureRect);

	m_Picture.SetPictureDispatch(m_pChartFX->GetPicture(CHART_METAFILE));
	InvalidateRect(m_PictureRect, FALSE);
	
}

void CCfxImpExp::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	
	// Do not call CDialog::OnPaint() for painting messages
	CDialog::OnPaint();
	m_Picture.Render(&dc, m_PictureRect, m_PictureRect);
}

⌨️ 快捷键说明

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