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

📄 gassandpressdesign.cpp

📁 这是本人两年前兼职为某个公司做的石油钻进设计软件
💻 CPP
字号:
// GasSandPressDesign.cpp : implementation file
//

#include "stdafx.h"
#include "CVenus.h"
#include "MainFrm.h"
#include "GasSandPressDesign.h"
#include	"ChildFrm.h"

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

/////////////////////////////////////////////////////////////////////////////
// CGasSandPressDesign

IMPLEMENT_DYNCREATE(CGasSandPressDesign, CFormView)

CGasSandPressDesign::CGasSandPressDesign()
	: CFormView(CGasSandPressDesign::IDD)
{
	//{{AFX_DATA_INIT(CGasSandPressDesign)
	m_bSand = FALSE;
	m_fDen = 0.0f;
	m_fPRec = 0.0f;
	m_fDt = 0.0f;
	m_fPMax = 0.0f;
	m_fPMin = 0.0f;
	//}}AFX_DATA_INIT
}

CGasSandPressDesign::~CGasSandPressDesign()
{
}

void CGasSandPressDesign::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CGasSandPressDesign)
	DDX_Control(pDX, IDC_EDIT_DT, m_ctrlDt);
	DDX_Control(pDX, IDC_EDIT_DEN, m_ctrlDen);
	DDX_Check(pDX, IDC_CHECK_SAND, m_bSand);
	DDX_Text(pDX, IDC_EDIT_DEN, m_fDen);
	DDX_Text(pDX, IDC_EDIT_DPREC, m_fPRec);
	DDX_Text(pDX, IDC_EDIT_DT, m_fDt);
	DDX_Text(pDX, IDC_EDIT_PMAX, m_fPMax);
	DDX_Text(pDX, IDC_EDIT_PMIN, m_fPMin);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CGasSandPressDesign, CFormView)
	ON_WM_CONTEXTMENU()
	//{{AFX_MSG_MAP(CGasSandPressDesign)
	ON_BN_CLICKED(IDC_RADIO_DT, OnRadioDt)
	ON_BN_CLICKED(IDC_RADIO_DEN, OnRadioDen)
	ON_COMMAND(ID_SPD_CACL, OnSpdCacl)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CGasSandPressDesign diagnostics

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

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

/////////////////////////////////////////////////////////////////////////////
// CGasSandPressDesign message handlers

void CGasSandPressDesign::OnRadioDt() 
{
	m_ctrlDen.EnableWindow(FALSE);
	m_ctrlDt.EnableWindow();
	m_bState = TRUE;
}

void CGasSandPressDesign::OnRadioDen() 
{
	m_ctrlDen.EnableWindow();
	m_ctrlDt.EnableWindow(FALSE);
	m_bState = FALSE;
}

void CGasSandPressDesign::OnInitialUpdate() 
{
	CFormView::OnInitialUpdate();
	CButton* pBtn = (CButton*)GetDlgItem(IDC_RADIO_DT);
	pBtn->SetCheck(true);
	OnRadioDt();
	CMainFrame*	wnd = (CMainFrame*)AfxGetMainWnd();

	GetParentFrame()->SetWindowText(_T("气井防砂负压设计"));
	UpdateData();
	m_fPMin = wnd->m_structSandPressDesign.fPMin;
	m_fPMax = wnd->m_structSandPressDesign.fPMax;
	m_fPRec = wnd->m_structSandPressDesign.fPRec;
	UpdateData(FALSE);
}



void CGasSandPressDesign::OnSpdCacl() 
{
	// TODO: Add your command handler code here
	UpdateData();
	CMainFrame*	wnd = (CMainFrame*)AfxGetMainWnd();
	float k = (float)(wnd->m_structBDTTable.fStratumFilterPercent*1000);
	if(k<=1)
		m_fPMin = (float)(0.7240 / k);
	else
		m_fPMin = (float)(4.974 / pow(k,0.18));

	if(m_bState)
		m_fPMax = (float)(33.095 - 0.0524 * m_fDt);
	else
		m_fPMax = (float)(20 * m_fDen - 32.4);
	if(m_bSand)
	{
		if(m_fPMin > m_fPMax)
			m_fPRec = (float)(0.8 * m_fPMax);
		else
			m_fPRec = (float)(0.8*m_fPMin + 0.2*m_fPMax);
	}
	else
		m_fPRec = (float)(0.2*m_fPMin + 0.8*m_fPMax);
	wnd->m_structSandPressDesign.fPMax = m_fPMax;
	wnd->m_structSandPressDesign.fPMin = m_fPMin;
	wnd->m_structSandPressDesign.fPRec = m_fPRec;
	UpdateData(FALSE);
	
}

#include "resource.h"
void CGasSandPressDesign::OnContextMenu(CWnd*, CPoint point)
{
	// CG: This block was added by the Pop-up Menu component	{		if (point.x == -1 && point.y == -1){			//keystroke invocation			CRect rect;			GetClientRect(rect);			ClientToScreen(rect);			point = rect.TopLeft();			point.Offset(5, 5);		}		CMenu menu;		VERIFY(menu.LoadMenu(IDR_POPUP_SPD));		CMenu* pPopup = menu.GetSubMenu(3);		ASSERT(pPopup != NULL);		CWnd* pWndPopupOwner = this;//		while (pWndPopupOwner->GetStyle() & WS_CHILD)//			pWndPopupOwner = pWndPopupOwner->GetParent();		pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y,			pWndPopupOwner);	}
}

⌨️ 快捷键说明

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