mymeter_evcdlg.cpp
来自「wince平台下的一个仪表控件」· C++ 代码 · 共 83 行
CPP
83 行
// MyMeter_EVCDlg.cpp : implementation file
//
#include "stdafx.h"
#include "MyMeter_EVC.h"
#include "MyMeter_EVCDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyMeter_EVCDlg dialog
CMyMeter_EVCDlg::CMyMeter_EVCDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMyMeter_EVCDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMyMeter_EVCDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CMyMeter_EVCDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMyMeter_EVCDlg)
DDX_Control(pDX, IDC_SLIDER1, m_slider);
DDX_Control(pDX, IDC_METER, m_myMeter);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMyMeter_EVCDlg, CDialog)
//{{AFX_MSG_MAP(CMyMeter_EVCDlg)
ON_WM_HSCROLL()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyMeter_EVCDlg message handlers
BOOL CMyMeter_EVCDlg::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
CenterWindow(GetDesktopWindow()); // center to the hpc screen
// TODO: Add extra initialization here
COLORREF m_colorNeedle;
m_colorNeedle = RGB(255, 255, 235);//etSysColor(COLOR_ACTIVEBORDER);
m_myMeter.SetNeedleColor(m_colorNeedle);
m_myMeter.SetColorTick(TRUE);
m_myMeter.m_strUnits = _T("车速");
m_myMeter.m_dMaxValue = 3000;
m_myMeter.UpdateNeedle(0) ;
m_slider.SetRange(0,300,true);
GetDlgItem(IDC_METER)->SetWindowPos(&CWnd::wndBottom,30,30,140,100,SWP_SHOWWINDOW);
return TRUE; // return TRUE unless you set the focus to a control
}
void CMyMeter_EVCDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default
int pos = m_slider.GetPos();
UpdateData(true);
m_myMeter.UpdateNeedle(pos);
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?