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

📄 propmodify4.cpp

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

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

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CFileMaSysApp theApp;
extern float NameWidth[];       //参与人员列宽
extern CString strUser[];
/////////////////////////////////////////////////////////////////////////////
// CPropModify4 property page

IMPLEMENT_DYNCREATE(CPropModify4, CPropertyPage)

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

CPropModify4::~CPropModify4()
{
}

void CPropModify4::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPropModify4)
	DDX_Control(pDX, IDC_BTN_MODIFY, m_BtnModifyControl);
	DDX_Control(pDX, IDC_BTN_DELETE, m_BtnDeleteControl);
	DDX_Control(pDX, IDC_DATAGRID_NAME, m_NameControl);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// CPropModify4 message handlers

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

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

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