📄 threedlg.cpp
字号:
// ThreeDlg.cpp : implementation file
//
#include "stdafx.h"
#include "TeeChart.h"
#include "Three.h"
#include "ThreeDlg.h"
#include "AboutDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CThreeDlg dialog
CThreeDlg::CThreeDlg(CWnd* pParent /*=NULL*/)
: CDialog(CThreeDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CThreeDlg)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CThreeDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CThreeDlg)
DDX_Control(pDX,ID2,m_CurveChart);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CThreeDlg, CDialog)
//{{AFX_MSG_MAP(CThreeDlg)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_WM_KEYUP()
ON_COMMAND(ID_MENUSUB, OnMenusub)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CThreeDlg message handlers
BOOL CThreeDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SHSipPreference(AfxGetMainWnd()->m_hWnd,SIP_DOWN);
// 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
// m_pWndEmptyCB=NULL;
SHMENUBARINFO mbi;
memset(&mbi, 0, sizeof(SHMENUBARINFO));
mbi.cbSize = sizeof(SHMENUBARINFO);
mbi.hwndParent =this->m_hWnd;
mbi.nToolBarId = IDR_MENUBAR;
mbi.hInstRes = ::AfxGetInstanceHandle();
mbi.nBmpId = 0;
mbi.cBmpImages = 0;
if (NULL == SHCreateMenuBar(&mbi))
{
MessageBox(TEXT("SHCreateMenuBar Failed"), TEXT("Error"), MB_OK);
}
CenterWindow(GetDesktopWindow()); // center to the hpc screen
m_CurveChart.Clear();
m_CurveChart.NodesCount=12;
CChartData *lpcd=m_CurveChart.NewCurve();
lpcd->SetColor(RGB(255,0,0));
lpcd->SetTitle("一氧化碳");
lpcd->AddData(100,1,"hello");
lpcd->AddData(200,2,"hello");
CChartData *lpcd2=m_CurveChart.NewCurve();
lpcd2->SetColor(RGB(255,255,0));
lpcd2->SetTitle("甲烷");
lpcd2->AddData(320,1,"hello");
lpcd2->AddData(200,3,"hello");
CChartData *lpcd3=m_CurveChart.NewCurve();
lpcd3->SetColor(RGB(0,255,0));
lpcd3->SetTitle("空气");
lpcd3->AddData(320,1);
lpcd3->AddData(50,4.5,"hello");
lpcd3->AddData(200,6,"hello");
m_CurveChart.Refresh();
// add tree display code
//
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
void CThreeDlg::OnButton1()
{
// TODO: Add your control notification handler code here
//AfxMessageBox(sTemp,MB_OK);
//CAboutDlg dlg_About;
//dlg_About.DoModal();
CAboutDlg *pDlg=new CAboutDlg;
pDlg->Create(IDD_DIALOG_ABOUT);
pDlg->ShowWindow(SW_SHOW);
}
void CThreeDlg::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
CString strMessage;
strMessage.Format(_T("Key is Presses.key id:%d"),nChar);
AfxMessageBox(strMessage);
CDialog::OnKeyUp(nChar, nRepCnt, nFlags);
}
void CThreeDlg::OnMenusub()
{
// TODO: Add your command handler code here
MessageBox(_T("hello"));
}
void CThreeDlg::OnPaint()
{
CPaintDC dc(this); // device context for paint
//CBrush SolidBrush(RGB(255,0,0));
//CBrush *pBrush=dc.SelectObject(&SolidBrush);
//dc.Rectangle(0,60,240,270);
//dc.SelectObject(pBrush);
///HICON hIcon;
//hIcon=AfxGetApp()->LoadIcon(IDR_MAINFRAME);
//dc.DrawIcon(0,-50,hIcon);
// TODO: Add your message handler code here
//pMenu->SetMenuItemBitmaps(1,MF_BYPOSITION,&bm_Menu1,&bm_Menu1);
// Do not call CDialog::OnPaint() for painting messages
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -