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

📄 propmodify3.cpp

📁 用Visual C++ 开发的项目管理系统
💻 CPP
字号:
// PropModify3.cpp : implementation file
//

#include "stdafx.h"
#include "FileMaSys.h"
#include "PropModify3.h"
#include "ModifySheet.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CFileMaSysApp theApp;
extern float FileWidth[];  //档案信息列宽
extern CString strFile[];
/////////////////////////////////////////////////////////////////////////////
// CPropModify3 property page

IMPLEMENT_DYNCREATE(CPropModify3, CPropertyPage)

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

CPropModify3::~CPropModify3()
{
}

void CPropModify3::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPropModify3)
	DDX_Control(pDX, IDC_BTN_MODIFY, m_BtnModifyControl);
	DDX_Control(pDX, IDC_BTN_DELETE, m_BtnDeleteControl);
	DDX_Control(pDX, IDC_DATAGRID_FILE, m_FileControl);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPropModify3, CPropertyPage)
	//{{AFX_MSG_MAP(CPropModify3)
	ON_BN_CLICKED(IDC_BTN_MODIFY, OnBtnModify)
	ON_BN_CLICKED(IDC_BTN_DELETE, OnBtnDelete)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPropModify3 message handlers

BOOL CPropModify3::OnSetActive() 
{
	// TODO: Add your specialized code here and/or call the base class
    ((CModifySheet *)GetParent())->SetWizardButtons(PSWIZB_NEXT | PSWIZB_BACK);
	//获得在第一个页面的工程名称
	m_cProName=(((CModifySheet *)GetParent())->m_ModifyPage1).m_cProName;
	//打开电子文档数据库
	CString sql;
	sql="Select * From FileTable Where ProjectName='"+m_cProName+"' ";
	m_RecordFile.CreateInstance("ADODB.Recordset");
	m_RecordFile->Open((_variant_t)sql,_variant_t((IDispatch *)theApp.m_pConnection,true),adOpenDynamic,
		adLockPessimistic,adCmdText);
	//将电子文档信息绑定到数据显示列表
	m_FileControl.SetRefDataSource(NULL);
	m_FileControl.SetRefDataSource((LPUNKNOWN)m_RecordFile);
	m_FileControl.SetColumnHeaders(TRUE);
	SetColumnWidth(m_FileControl,6,FileWidth,strFile);
	m_FileControl.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();
}

//DEL void CPropModify3::CalcWindowRect(LPRECT lpClientRect, UINT nAdjustType) 
//DEL {
//DEL 	// TODO: Add your specialized code here and/or call the base class
//DEL 	
//DEL 	CPropertyPage::CalcWindowRect(lpClientRect, nAdjustType);
//DEL }

void CPropModify3::OnBtnModify() 
{
	// TODO: Add your control notification handler code here
	m_RecordFile->Update();
}

void CPropModify3::OnBtnDelete() 
{
	// TODO: Add your control notification handler code here
	m_RecordFile->Delete(adAffectCurrent);
}

void CPropModify3::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 + -