📄 propmodify2.cpp
字号:
// PropModify2.cpp : implementation file
//
#include "stdafx.h"
#include "FileMaSys.h"
#include "PropModify2.h"
#include "ModifySheet.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CFileMaSysApp theApp;
extern float ProWidth[]; //项目信息列宽
extern CString strProInfo[];
extern float EFileWidth[]; //电子文件列宽
extern CString strEFile[];
/////////////////////////////////////////////////////////////////////////////
// CPropModify2 property page
IMPLEMENT_DYNCREATE(CPropModify2, CPropertyPage)
CPropModify2::CPropModify2() : CPropertyPage(CPropModify2::IDD)
{
//{{AFX_DATA_INIT(CPropModify2)
//}}AFX_DATA_INIT
}
CPropModify2::~CPropModify2()
{
}
void CPropModify2::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPropModify2)
DDX_Control(pDX, IDC_BTN_DELETE, m_BtnDeleteControl);
DDX_Control(pDX, IDC_BTN_MODIFY, m_BtnModifyControl);
DDX_Control(pDX, IDC_DATAGRID_EFILE, m_EFileControl);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPropModify2, CPropertyPage)
//{{AFX_MSG_MAP(CPropModify2)
ON_BN_CLICKED(IDC_BTN_MODIFY, OnBtnModify)
ON_BN_CLICKED(IDC_BTN_DELETE, OnBtnDelete)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPropModify2 message handlers
BOOL CPropModify2::OnSetActive()
{
// TODO: Add your specialized code here and/or call the base class
((CModifySheet *)GetParent())->SetWizardButtons(PSWIZB_BACK | PSWIZB_NEXT);
//获得在第一个页面的工程名称
m_cProName=(((CModifySheet *)GetParent())->m_ModifyPage1).m_cProName;
//打开电子文档数据库
CString sql;
sql="Select * From FileElectron Where ProjectName='"+m_cProName+"' ";
m_RecordEFile.CreateInstance("ADODB.Recordset");
m_RecordEFile->Open((_variant_t)sql,_variant_t((IDispatch *)theApp.m_pConnection,true),adOpenDynamic,
adLockPessimistic,adCmdText);
//将电子文档信息绑定到数据显示列表
m_EFileControl.SetRefDataSource(NULL);
m_EFileControl.SetRefDataSource((LPUNKNOWN)m_RecordEFile);
m_EFileControl.SetColumnHeaders(TRUE);
SetColumnWidth(m_EFileControl,8,EFileWidth,strEFile);
m_EFileControl.Refresh();
//设置修改按钮
m_BtnModifyControl.SetIcon(IDI_ICON_MODIFY);
m_BtnModifyControl.DrawTransparent(TRUE);
m_BtnModifyControl.SetColor(CButtonST::BTNST_COLOR_FG_IN,RGB(255,0,0));
m_BtnModifyControl.SetAlign(CButtonST::ST_ALIGN_HORIZ);
//设置删除按钮
m_BtnDeleteControl.SetIcon(IDI_ICON_DELETE);
m_BtnDeleteControl.DrawTransparent(TRUE);
m_BtnDeleteControl.SetColor(CButtonST::BTNST_COLOR_FG_IN,RGB(255,0,0));
m_BtnDeleteControl.SetAlign(CButtonST::ST_ALIGN_HORIZ);
return CPropertyPage::OnSetActive();
}
void CPropModify2::OnBtnModify()
{
// TODO: Add your control notification handler code here
m_RecordEFile->Update();
MessageBox("修改成功");
}
void CPropModify2::OnBtnDelete()
{
// TODO: Add your control notification handler code here
m_RecordEFile->Delete(adAffectCurrent);
}
void CPropModify2::SetColumnWidth(CDataGrid &ProControl, short count, float *WidthArray, CString *strTitle)
{
_variant_t vIndex;
for (int i=0;i<count;i++)
{
vIndex=long(i);
((ProControl.GetColumns()).GetItem(vIndex)).SetWidth(WidthArray[i]);
((ProControl.GetColumns()).GetItem(vIndex)).SetCaption(strTitle[i]);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -