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

📄 玻璃划分程序view.cpp

📁 关于玻璃划分的小程序很不完善对这有兴趣的大家讨论讨论
💻 CPP
字号:
// 玻璃划分程序View.cpp : implementation of the CMyView class
//

#include "stdafx.h"
#include "玻璃划分程序.h"

#include "玻璃划分程序Doc.h"
#include "玻璃划分程序View.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMyView

IMPLEMENT_DYNCREATE(CMyView, CFormView)

BEGIN_MESSAGE_MAP(CMyView, CFormView)
	//{{AFX_MSG_MAP(CMyView)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
	ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CMyView construction/destruction

CMyView::CMyView()
	: CFormView(CMyView::IDD)
{
	//{{AFX_DATA_INIT(CMyView)
	m_chang = 0.0f;
	m_kuan = 0.0f;
	m_shumu = 0;
	m_l = 0.0f;
	m_w = 0.0f;
	//}}AFX_DATA_INIT
	// TODO: add construction code here

}

CMyView::~CMyView()
{
}

void CMyView::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMyView)
	DDX_Text(pDX, IDC_EDIT1, m_chang);
	DDX_Text(pDX, IDC_EDIT2, m_kuan);
	DDX_Text(pDX, IDC_EDIT3, m_shumu);
	DDX_Text(pDX, IDC_EDIT4, m_l);
	DDX_Text(pDX, IDC_EDIT5, m_w);
	//}}AFX_DATA_MAP
}

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

	return CFormView::PreCreateWindow(cs);
}

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

}

/////////////////////////////////////////////////////////////////////////////
// CMyView printing

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

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CMyView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CMyView message handlers

void CMyView::OnButton1() 
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	
	CMyDoc* pDoc=(CMyDoc*)GetDocument();
	pDoc->m_length=m_chang;
	pDoc->m_width=m_kuan;


	pDoc->UpdateAllViews(NULL);
}

void CMyView::OnButton2() 
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	
	
	CMyDoc* pDoc=(CMyDoc*)GetDocument();
    pDoc->m_sm=m_shumu;




	pDoc->UpdateAllViews(NULL);
}

void CMyView::OnButton3() 
{
	// TODO: Add your control notification handler code here

    UpdateData(TRUE);
	
	int x;
    
	CMyDoc* pDoc=(CMyDoc*)GetDocument();
    for(x=0;x<pDoc->m_sm;x++)
	{
		pDoc->m_cfxc[x]=m_l;
		pDoc->m_cfxk[x]=m_w;
		

	}
	





	
	
}

void CMyView::OnButton4() 
{
	// TODO: Add your control notification handler code here
   
	int i,x;
	int r,s,t;
	UpdateData(TRUE);
    CMyDoc* pDoc=(CMyDoc*)GetDocument();
     for(i=0;i<pDoc->m_sm;i++)
	 {

     pDoc->m_s[i]=pDoc->m_cfxc[i]*pDoc->m_cfxk[i];
     pDoc->m_a[i]=pDoc->m_cfxc[i];
	 pDoc->m_b[i]=pDoc->m_cfxk[i];

	 }
      for(x=pDoc->m_sm-1;x>=0;x--)
	  {
		 for(i=pDoc->m_sm-1;i>=0;i--)
		 {
			 if(pDoc->m_s[i]<pDoc->m_s[i+1])
			 {
				 t=pDoc->m_s[i];
				 pDoc->m_s[i]=pDoc->m_s[i+1];
				 pDoc->m_s[i+1]=t;

                                 r=pDoc->m_a[i];
				 pDoc->m_a[i]=pDoc->m_a[i+1];
				 pDoc->m_a[i+1]=r;

				 s=pDoc->m_b[i];
				 pDoc->m_b[i]=pDoc->m_b[i+1];
				 pDoc->m_b[i+1]=s;
				 
                
			 }
		 }
			 

	  }

	pDoc->UpdateAllViews(NULL);
}

⌨️ 快捷键说明

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