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

📄 wincechartdlg.cpp

📁 BCB CHART控件 在Wince5.0下的移植
💻 CPP
字号:
// WinceChartDlg.cpp : implementation file
//

#include "stdafx.h"
#include "WinceChart.h"
#include "WinceChartDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

// CWinceChartDlg dialog

CWinceChartDlg::CWinceChartDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CWinceChartDlg::IDD, pParent)
{
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CWinceChartDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);

	DDX_Control(pDX, IDC_CHARTCTRL, m_ChartCtrl);
}

BEGIN_MESSAGE_MAP(CWinceChartDlg, CDialog)
#if defined(_DEVICE_RESOLUTION_AWARE) && !defined(WIN32_PLATFORM_WFSP)
	ON_WM_SIZE()
#endif
	//}}AFX_MSG_MAP
	ON_WM_SIZE()
END_MESSAGE_MAP()

BEGIN_EASYSIZE_MAP(CWinceChartDlg)

    EASYSIZE(IDC_CHARTCTRL,ES_BORDER,ES_BORDER,ES_BORDER,ES_BORDER,0)

END_EASYSIZE_MAP
// CWinceChartDlg message handlers

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

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	//---------------------------------------------------
	//CRect   m_FullScreenRect;   //全屏区域  
	//CRect   WindowRect;    
	//
	//GetWindowRect(&WindowRect);    
	//
	//CRect   ClientRect;  
	//RepositionBars(0,   0xffff,   AFX_IDW_PANE_FIRST,   reposQuery,   &ClientRect);  
	//
	//ClientToScreen(&ClientRect);    
	//
	//int   nFullWidth		=	GetSystemMetrics(SM_CXSCREEN);  
	//int   nFullHeight		=	GetSystemMetrics(SM_CYSCREEN);  
	//
	//m_FullScreenRect.left   =   WindowRect.left		-	ClientRect.left;  
	//m_FullScreenRect.top	=	WindowRect.top		-	ClientRect.top;  
	//m_FullScreenRect.right	=	WindowRect.right	-	ClientRect.right+nFullWidth;  
	//m_FullScreenRect.bottom	=	WindowRect.bottom	-	ClientRect.bottom+nFullHeight;  
	//
	//this->SetWindowPos(&wndBottom,	m_FullScreenRect.left,
	//								m_FullScreenRect.top,
	//								m_FullScreenRect.Width(),
	//								m_FullScreenRect.Height(),0);

	//WINCE下如何设置窗口最大化和最小化?
	//WINCE 的帮助文档在介绍API ShowWindow函数的参数时指出
	//SW_MAXIMIZE, SW_MINIMIZE, 
	//SW_RESTORE,SW_SHOWDEFAULT, 
	//SW_SHOWMAXIMIZED, SW_SHOWMINIMIZED, 
	//SW_SHOWMINNOACTIVE
	//都不被支持,但实际上并不完全是这样,具体来说:
	//
	//SW_MAXIMIZE				比原来窗口大,但不是最大化
	//SW_MINIMIZE				编译成功,但是不起作用
	//SW_SHOWMAXIMIZED			最大化
	//SW_SHOWMINIMIZED			编译出错
	//SW_RESTORE				能恢复
	//SW_SHOWDEFAULT			编译出错
	//SW_SHOWMINNOACTIVE		编译出错
	//SW_HIDE					能够隐藏

	this->ShowWindow(SW_SHOWMAXIMIZED);
	//---------------------------------------------------

	// TODO: Add extra initialization here
	//---------------------------------------------------

	CChartSerie* pSeries = m_ChartCtrl.AddSerie(0);

	int NumberPoints = 500;

	double XValues[500];
	double YValues[500];

	for (int i = 0 ; i < NumberPoints ; i++)
	{
		XValues[i] = i;//XStart + i * Step;
		YValues[i] = 10 * (1+sin( 3.141592/180 * (i%360) ));
	}

	CChartAxis* pAxisB = m_ChartCtrl.GetBottomAxis();
	pAxisB->SetMinMax(0,500);
	pAxisB->SetAutomatic(true);

	CChartAxis* pAxisL = m_ChartCtrl.GetLeftAxis();
	pAxisL->SetMinMax(0,20);
	pAxisL->SetAutomatic(true);

	pSeries->SetPoints(XValues,YValues,NumberPoints);
	
	INIT_EASYSIZE;

	return TRUE;  // return TRUE  unless you set the focus to a control
}

#if defined(_DEVICE_RESOLUTION_AWARE) && !defined(WIN32_PLATFORM_WFSP)
void CWinceChartDlg::OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/)
{
	if (AfxIsDRAEnabled())
	{
		DRA::RelayoutDialog(
			AfxGetResourceHandle(), 
			this->m_hWnd, 
			DRA::GetDisplayMode() != DRA::Portrait ? 
			MAKEINTRESOURCE(IDD_WinceChart_DIALOG_WIDE) : 
			MAKEINTRESOURCE(IDD_WinceChart_DIALOG));
	}
}
#endif


void CWinceChartDlg::OnSize(UINT nType, int cx, int cy)
{
	CDialog::OnSize(nType, cx, cy);

	// TODO: 在此处添加消息处理程序代码
	UPDATE_EASYSIZE;
}

⌨️ 快捷键说明

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