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

📄 cfxmouse.cpp

📁 Delphi Component - Chart Fx
💻 CPP
字号:
// CfxMouse.cpp : implementation file
//

#include "stdafx.h"
#include "cfx98.h"
#include "CfxMouse.h"

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

/////////////////////////////////////////////////////////////////////////////
// CCfxMouse dialog


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


void CCfxMouse::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCfxMouse)
		// 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(CCfxMouse, CDialog)
	//{{AFX_MSG_MAP(CCfxMouse)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCfxMouse message handlers



BOOL CCfxMouse::DestroyWindow() 
{
	// TODO: Add your specialized code here and/or call the base class

	m_pChartFX = NULL;
	
	return CDialog::DestroyWindow();
}

BEGIN_EVENTSINK_MAP(CCfxMouse, CDialog)
    //{{AFX_EVENTSINK_MAP(CCfxMouse)
	ON_EVENT(CCfxMouse, IDC_CHART1, 25 /* MouseMoving */, OnMouseMovingChart1, VTS_I2 VTS_I2 VTS_PI2)
	//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()

static LPCSTR sHitName[] = {"Background","2D Background Area","3D Background Area","Value (middle)","Point Marker",
"Y Axis","Secondary Y-Axis","X-Axis","Secondary X Axis","Left Title","Right Title","Top Title","Bottom Title"};

void CCfxMouse::OnMouseMovingChart1(short x, short y, short FAR* nRes) 
{
    //Dim nHit As CfxHitTest
	//CfxHitTest nHit;
	short nHit,nSeries;
    long nPoint;
	char buffer[20];
    
    
	itoa(x,buffer,10);
	SetDlgItemText(IDC_X, buffer);

	itoa(y,buffer,10);
    SetDlgItemText(IDC_Y, buffer);
    
    nHit = m_pChartFX->HitTest(x, y, &nSeries, &nPoint);

	itoa(nSeries+1,buffer,10);
	SetDlgItemText(IDC_SERIES, buffer);

    itoa(nPoint+1,buffer,10);
	SetDlgItemText(IDC_POINT, buffer);
    
	if ((nHit>=0) && (nHit<13)) 
		SetDlgItemText(IDC_HITELEM, sHitName[nHit]);
	else
		SetDlgItemText(IDC_HITELEM,"Unknown!");
}

BOOL CCfxMouse::OnInitDialog() 
{
	
	
	CDialog::OnInitDialog();

	ICfxAxisPtr pAxis;

    m_pChartFX->TypeMask = (CfxType) (m_pChartFX->TypeMask | CT_TRACKMOUSE);
    
    
    
    // Show Secondary Y-Axis
	pAxis = m_pChartFX->Axis->Item[AXIS_Y2];
    pAxis->Min = 0;
    pAxis->Max = 1000;
    pAxis->Style = (CfxAxisStyle) (pAxis->Style & ~AS_HIDE);
        
    // Show Titles
    m_pChartFX->Title[CHART_LEFTTIT] = "What's this ?";
    m_pChartFX->Title[CHART_TOPTIT] = "What's this ?";
    m_pChartFX->Title[CHART_RIGHTTIT] = "What's this ?";
    m_pChartFX->Title[CHART_BOTTOMTIT] = "What's this ?";
    // Make it stacked
    m_pChartFX->Stacked = CHART_STACKED;
    m_pChartFX->RecalcScale();

	

	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

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