📄 dialogprojectmodify.cpp
字号:
// DialogProjectModify.cpp : implementation file
//
#include "stdafx.h"
#include "CVenus.h"
#include "DialogProjectModify.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDialogProjectModify dialog
CDialogProjectModify::CDialogProjectModify(
CString cstrProjectPath,
STRUCTWELLINFO* structWellInfo,
CString cstrSDTPath,
CString cstrEDTPath,
CWnd* pParent /*=NULL*/)
: CDialog(CDialogProjectModify::IDD, pParent)
{
//{{AFX_DATA_INIT(CDialogProjectModify)
m_cstrAuditing = structWellInfo->strAuditing ;
m_cstrCo = structWellInfo->strCo ;
m_cstrDate = structWellInfo->strDate ;
m_cstrOilFieldName = structWellInfo->strOilFieldName ;
m_cstrProjectPath = cstrProjectPath;
m_cstrSDTPath = cstrSDTPath;
m_cstrWellName = structWellInfo->strWellName ;
m_cstrStylist = structWellInfo->strStylist;
//}}AFX_DATA_INIT
if(structWellInfo->bWellState == TRUE)
{
m_iGasWell = -1;
m_iOilWell = 0;
}
else
{
m_iGasWell = 0;
m_iOilWell = -1;
}
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CDialogProjectModify::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDialogProjectModify)
DDX_Text(pDX, IDC_EDIT_AUDITING_MODIFY, m_cstrAuditing);
DDV_MaxChars(pDX, m_cstrAuditing, 20);
DDX_Text(pDX, IDC_EDIT_CONCORP_MODIFY, m_cstrCo);
DDV_MaxChars(pDX, m_cstrCo, 40);
DDX_Text(pDX, IDC_EDIT_DATE_MODIFY, m_cstrDate);
DDV_MaxChars(pDX, m_cstrDate, 20);
DDX_Text(pDX, IDC_EDIT_OILFIELDNAME_MODIFY, m_cstrOilFieldName);
DDV_MaxChars(pDX, m_cstrOilFieldName, 40);
DDX_Text(pDX, IDC_EDIT_PROJECTPATH_MODIFY, m_cstrProjectPath);
DDX_Text(pDX, IDC_EDIT_SDTPATH_MODIFY, m_cstrSDTPath);
DDX_Text(pDX, IDC_EDIT_WELLNAME_MODIFY, m_cstrWellName);
DDV_MaxChars(pDX, m_cstrWellName, 40);
DDX_Radio(pDX, IDC_RADIO_GASWELL_MODIFY, m_iGasWell);
DDX_Radio(pDX, IDC_RADIO_OILWELL_MODIFY, m_iOilWell);
DDX_Text(pDX, IDC_EDIT_STYLIST_MODIFY, m_cstrStylist);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDialogProjectModify, CDialog)
//{{AFX_MSG_MAP(CDialogProjectModify)
ON_BN_CLICKED(IDC_RADIO_OILWELL_MODIFY, OnRadioOilwellModify)
ON_BN_CLICKED(IDC_RADIO_GASWELL_MODIFY, OnRadioGaswellModify)
ON_BN_CLICKED(IDC_BUTTON_SDT_BROWSE_MODIFY, OnButtonSdtBrowseModify)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDialogProjectModify message handlers
void CDialogProjectModify::OnRadioOilwellModify()
{
// TODO: Add your control notification handler code here
UpdateData();
m_iOilWell = 0;
m_iGasWell = -1;
UpdateData(FALSE);
}
void CDialogProjectModify::OnRadioGaswellModify()
{
// TODO: Add your control notification handler code here
UpdateData();
m_iOilWell = -1;
m_iGasWell = 0;
UpdateData(FALSE);
}
void CDialogProjectModify::OnButtonSdtBrowseModify()
{
// TODO: Add your control notification handler code here
CFileDialog fileDialog(
TRUE,"SDT",NULL,
OFN_HIDEREADONLY ,
"*.SDT|*.SDT|",
NULL);
fileDialog.m_ofn.lpstrInitialDir = ".\\sdt\\"; // add by lzj
if(fileDialog.DoModal ()==IDCANCEL)
return;
CFile fileHandle;
char fileHead[6];
if(fileHandle.Open(
fileDialog.GetPathName() ,
CFile::modeRead))
{
CString cstrTemp;
cstrTemp = _T("[SDT]");
fileHandle.Read (fileHead,6);
fileHandle.Close ();
if(cstrTemp.Compare (fileHead) == 0)
{
UpdateData();
m_cstrSDTPath = fileDialog.GetPathName() ;
UpdateData(FALSE);
}
else
{
MessageBox("文件格式错误 !","错误");
}
}
else
{
MessageBox("文件不存在 !","错误");
}
}
void CDialogProjectModify::OnOK()
{
// TODO: Add extra validation here
UpdateData();
if(m_cstrProjectPath.IsEmpty ())
{
MessageBox("请输入工程路径及名字 !","错误");
return;
}
if(m_cstrSDTPath.IsEmpty()
||m_cstrWellName.IsEmpty())
{
MessageBox("必须输入 井名与射孔弹型表 !","错误");
return;
}
UpdateData(FALSE);
CDialog::OnOK();
}
void CDialogProjectModify::OnDestroy()
{
CDialog::OnDestroy();
// TODO: Add your message handler code here
UpdateData();
if(m_iOilWell == 0)
m_bWellState = TRUE;
else
m_bWellState = FALSE;
UpdateData(FALSE);
}
BOOL CDialogProjectModify::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -