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

📄 cmdview.cpp

📁 弯管机的弯管控制程序。可以在弯管机加工前分析管型与机型是否能够加工出来。
💻 CPP
字号:
// cmdView.cpp : implementation file
//

#include "stdafx.h"
#include "WanGuan.h"
#include "cmdView.h"
#include "MainFrm.h"
#include "YBC.h"
#include "WanGuanView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CcmdView

IMPLEMENT_DYNCREATE(CcmdView, CFormView)

CcmdView::CcmdView()
	: CFormView(CcmdView::IDD)
{
	//{{AFX_DATA_INIT(CcmdView)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}

CcmdView::~CcmdView()
{
}

void CcmdView::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CcmdView)
	DDX_Control(pDX, IDC_LIST_CMD, m_listCmd);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CcmdView, CFormView)
	//{{AFX_MSG_MAP(CcmdView)
	ON_WM_SIZE()
	//}}AFX_MSG_MAP
	ON_MESSAGE(WM_CELLCHANGED, OnCellChanged)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CcmdView diagnostics

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

void CcmdView::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CcmdView message handlers



CView * CcmdView::GetWanGuanView()
{
	CWanGuanApp *pApp = (CWanGuanApp *)AfxGetApp();
	CMainFrame *pFrame = (CMainFrame *)pApp->m_pMainWnd;
	CView *pView = (CView *)pFrame->m_wndSplitter.GetPane(0,1);
	return pView;	
}

void CcmdView::OnInitialUpdate() 
{
	CFormView::OnInitialUpdate();
	
	// TODO: Add your specialized code here and/or call the base class
	//消除滚动条
	CRect rectView;
	GetWindowRect(&rectView);
	SetScrollSizes(MM_TEXT,CSize(rectView.Width(),rectView.Height()));
	//全行选择
	::SendMessage(m_listCmd.m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE,LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
	m_listCmd.EnableEditable(TRUE);
	//清空列表
	m_listCmd.DeleteAllItems();
	m_listCmd.InsertColumn(0,"索引");
	m_listCmd.InsertColumn(1,"Y");
	m_listCmd.InsertColumn(2,"B");
	m_listCmd.InsertColumn(3,"C");
	m_listCmd.InsertColumn(4,"TR");
	m_listCmd.SetColumnWidth(0,10);
	m_listCmd.SetColumnWidth(1,40);
	m_listCmd.SetColumnWidth(2,40);
	m_listCmd.SetColumnWidth(3,40);
	m_listCmd.SetColumnWidth(4,40);
	//设置该列可编辑
	m_listCmd.EnableColEditable(1,TRUE);
	m_listCmd.EnableColEditable(2,TRUE);
	m_listCmd.EnableColEditable(3,TRUE);
	m_listCmd.EnableColEditable(4,TRUE);
	//显示网格
	m_listCmd.SetExtendedStyle(LVS_EX_GRIDLINES);
	if (gYBCs.GetSize()>0)
	{
		for (int i=0;i<gYBCs.GetSize();i++)
		{
			//插入行
			m_listCmd.InsertItem(i,"",0);
			CString strTmp;
			strTmp.Format("%d",i);
			//设置列表内容
			m_listCmd.SetItemText(i,0,strTmp);
			strTmp.Format("%d",int(gYBCs[i].fY));
			m_listCmd.SetItemText(i,1,strTmp);
			strTmp.Format("%d",int(gYBCs[i].fB));
			m_listCmd.SetItemText(i,2,strTmp);
			strTmp.Format("%d",int(gYBCs[i].fC));
			m_listCmd.SetItemText(i,3,strTmp);
			strTmp.Format("%d",int(gYBCs[i].fR));
			m_listCmd.SetItemText(i,4,strTmp);
		}
	}
}

void CcmdView::OnCellChanged(WPARAM wParm, LPARAM lParm)
{
	int row=wParm;
	int col=lParm;
	CString strTmp=m_listCmd.GetItemText(row,col);
	char * s;
	float fTmp=strtod(strTmp,&s);
	switch(col) 
	{
	case 1:
		gYBCs[row].fY=fTmp;
		break;
	case 2:
		gYBCs[row].fB=fTmp;
		break;
	case 3:
		gYBCs[row].fC=fTmp;
		break;
	case 4:
		gYBCs[row].fR=fTmp;
		break;
	default:
		break;
	}
	CWanGuanView * pView=(CWanGuanView*)GetWanGuanView();

	pView->InvalidateRect(NULL,FALSE);

}

void CcmdView::OnSize(UINT nType, int cx, int cy) 
{
	CFormView::OnSize(nType, cx, cy);
	
	// TODO: Add your message handler code here
	if (m_listCmd.GetSafeHwnd()!=NULL)
	{
		m_listCmd.MoveWindow(0,0,cx,cy);
	}
}

⌨️ 快捷键说明

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