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

📄 hyzxfview.cpp

📁 此对画框能够实现数据采集的基本操作
💻 CPP
字号:
// hyzxfView.cpp : implementation of the CHyzxfView class
//

#include "stdafx.h"
#include "hyzxf.h"

#include "hyzxfDoc.h"
#include "hyzxfView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CHyzxfView

IMPLEMENT_DYNCREATE(CHyzxfView, CFormView)

BEGIN_MESSAGE_MAP(CHyzxfView, CFormView)
	//{{AFX_MSG_MAP(CHyzxfView)
	ON_CBN_EDITCHANGE(IDC_COMBO1, OnEditchangeCombo1)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CFormView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CFormView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CFormView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CHyzxfView construction/destruction

CHyzxfView::CHyzxfView()
	: CFormView(CHyzxfView::IDD)
{
	//{{AFX_DATA_INIT(CHyzxfView)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	// TODO: add construction code here

}

CHyzxfView::~CHyzxfView()
{
}

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

BOOL CHyzxfView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CFormView::PreCreateWindow(cs);
}

void CHyzxfView::OnInitialUpdate()
{
	CFormView::OnInitialUpdate();
	GetParentFrame()->RecalcLayout();
	ResizeParentToFit();
	initial();


}

/////////////////////////////////////////////////////////////////////////////
// CHyzxfView printing

BOOL CHyzxfView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CHyzxfView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CHyzxfView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

void CHyzxfView::OnPrint(CDC* pDC, CPrintInfo* /*pInfo*/)
{
	// TODO: add customized printing code here
}

/////////////////////////////////////////////////////////////////////////////
// CHyzxfView diagnostics

#ifdef _DEBUG
void CHyzxfView::AssertValid() const
{
	CFormView::AssertValid();
}

void CHyzxfView::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}

CHyzxfDoc* CHyzxfView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CHyzxfDoc)));
	return (CHyzxfDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CHyzxfView message handlers

void CHyzxfView::OnEditchangeCombo1() 
{
	// TODO: Add your control notification handler code here
int index;
	index=m_SampleTSet.GetCurSel();

	switch (index)
	{
	case 0:
	    m_SampleT = 2;
		break;
	case 1:
	    m_SampleT = 5;
      	break;
	case 2:
	   m_SampleT = 10;
		break;
	case 3:
         m_SampleT = 20;
     	break;
	case 4:
         m_SampleT = 50;
     	break;
	case 5:
         m_SampleT = 100;
    break;
	}	
}

void CHyzxfView::OnDraw(CDC* pDC) 
{
	// TODO: Add your specialized code here and/or call the base class
	
	
}

void CHyzxfView::initial()
{     //周期组合框
     ((CComboBox*)GetDlgItem(IDC_COMBO1))->InsertString(0,"5");
     ((CComboBox*)GetDlgItem(IDC_COMBO1))->InsertString(1,"10");
     ((CComboBox*)GetDlgItem(IDC_COMBO1))->InsertString(2,"15");
     ((CComboBox*)GetDlgItem(IDC_COMBO1))->InsertString(3,"20");
     ((CComboBox*)GetDlgItem(IDC_COMBO1))->InsertString(4,"25");

     //串口组合框
	 ((CComboBox*)GetDlgItem(IDC_COMBO_COMPORTSEL))->InsertString(0,"com1");
	 ((CComboBox*)GetDlgItem(IDC_COMBO_COMPORTSEL))->InsertString(1,"com2");
	 ((CComboBox*)GetDlgItem(IDC_COMBO_COMPORTSEL))->InsertString(2,"com3");

     //频率组合框
     ((CComboBox*)GetDlgItem(IDC_COMBO_PWMFREQSEL))->InsertString(0,"10");
	 ((CComboBox*)GetDlgItem(IDC_COMBO_PWMFREQSEL))->InsertString(1,"100");
	 ((CComboBox*)GetDlgItem(IDC_COMBO_PWMFREQSEL))->InsertString(2,"1000");
	 ((CComboBox*)GetDlgItem(IDC_COMBO_PWMFREQSEL))->InsertString(3,"10000");


}

⌨️ 快捷键说明

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