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

📄 chbutton.cpp

📁 基于固高运动控制卡的二轴步进电机控制软件
💻 CPP
字号:
// Chbutton.cpp : implementation file
//

#include "stdafx.h"
#include "test.h"
#include "Chbutton.h"
#include "beihangdlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CChbutton

CChbutton::CChbutton()
{
	which=0;
}

CChbutton::~CChbutton()
{
}


BEGIN_MESSAGE_MAP(CChbutton, CButton)
	//{{AFX_MSG_MAP(CChbutton)
	ON_CONTROL_REFLECT(BN_CLICKED, OnClicked)
	ON_WM_CHAR()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CChbutton message handlers
char info1[]="定位检测和Z轴连续检测(切换)";
char info2[]="双轴连续扫描检测(切换)";
void CChbutton::OnClicked() 
{CWnd* p=GetParent();
CBeihangDlg* pbd=(CBeihangDlg*)p;
	// TODO: Add your control notification handler code here
	if(which==0)
	{this->SetWindowText(info2);
	 pbd->VisSwitch(1,1);
	 which=1;
	 pbd->params.axisRrun(60,-pbd->m_dblRCurPos);
			long time_start,time_temp;
			time(&time_start);	time_temp=0;
			while((double)(time_temp-time_start)<(abs(pbd->m_dblRCurPos)/60+1))
			time(&time_temp);			
	 pbd->m_dblConRStart=0;
	 pbd->m_dblRCurPos=0;
	 pbd->m_dblConZStart=pbd->m_dblZCurPos; 
	}else
	{this->SetWindowText(info1);
	 pbd->VisSwitch(0,1);
	 which=0;
	 pbd->m_dblRCurPos=pbd->m_dblConRStart;
	 pbd->m_dblZCurPos=pbd->m_dblConZStart;
	}
pbd->UpdateData(0);
}


void CChbutton::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	// TODO: Add your message handler code here and/or call default
	if(nChar==VK_SPACE)
		nChar=nChar;
	CButton::OnChar(nChar, nRepCnt, nFlags);
}

⌨️ 快捷键说明

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