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

📄 dlgsysfunctioninfo.cpp

📁 sql server 7.0 and vc 6.0 complete a shop system.
💻 CPP
字号:
// DlgSysFunctionInfo.cpp : implementation file
//

#include "stdafx.h"
#include "MerchandiseStore.h"
#include "DlgSysFunctionInfo.h"

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

#include "Database.h"
//-------------global 
extern CDatabase m_hDatabase ;
//------------end

/////////////////////////////////////////////////////////////////////////////
// CDlgSysFunctionInfo dialog


CDlgSysFunctionInfo::CDlgSysFunctionInfo(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgSysFunctionInfo::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgSysFunctionInfo)
	//}}AFX_DATA_INIT
}


void CDlgSysFunctionInfo::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgSysFunctionInfo)
	DDX_Control(pDX, IDOK, m_hBtnOk);
	DDX_Control(pDX, IDD_BTN_SAVE, m_hBtnSave);
	DDX_Control(pDX, IDD_BTN_DEL, m_hBtnDel);
	DDX_Control(pDX, IDD_BTN_ADD, m_hBtnAdd);
	DDX_Control(pDX, IDC_LIST_SYSFUNCTIONINFO, m_hListSysFunctionInfo);
	DDX_Control(pDX, IDC_EDIT_SYSFUNCTIONINFO, m_hEditSysFunctionInfo);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgSysFunctionInfo, CDialog)
	//{{AFX_MSG_MAP(CDlgSysFunctionInfo)
	ON_NOTIFY(NM_CLICK, IDC_LIST_DEPARTMENT, OnClickListDepartment)
	ON_NOTIFY(NM_DBLCLK, IDC_LIST_DEPARTMENT, OnDblclkListDepartment)
	ON_BN_CLICKED(IDD_BTN_ADD, OnBtnAdd)
	ON_BN_CLICKED(IDD_BTN_DEL, OnBtnDel)
	ON_BN_CLICKED(IDD_BTN_SAVE, OnBtnSave)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgSysFunctionInfo message handlers

BOOL CDlgSysFunctionInfo::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	InitCtrlData() ;
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CDlgSysFunctionInfo::OnClickListDepartment(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	
	*pResult = 0;
}

void CDlgSysFunctionInfo::OnDblclkListDepartment(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	
	*pResult = 0;
}

void CDlgSysFunctionInfo::InitCtrlData()
{
	m_hBtnOk.SetIcon(IDI_ICON_CLOSE);
	m_hBtnOk.OffsetColor(CButtonST::BTNST_COLOR_BK_IN, shBtnColor);
	m_hBtnOk.SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(0, 128, 0));

	m_hBtnSave.SetIcon(IDI_ICON_OK);
	m_hBtnSave.OffsetColor(CButtonST::BTNST_COLOR_BK_IN, shBtnColor);
	m_hBtnSave.SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(0, 128, 0));
	m_hBtnSave.EnableWindow(FALSE) ;

	m_hBtnDel.SetIcon(IDI_ICON_DEL);
	m_hBtnDel.OffsetColor(CButtonST::BTNST_COLOR_BK_IN, shBtnColor);
	m_hBtnDel.SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(0, 128, 0));

	m_hBtnAdd.SetIcon(IDI_ICON_ADD);
	m_hBtnAdd.OffsetColor(CButtonST::BTNST_COLOR_BK_IN, shBtnColor);
	m_hBtnAdd.SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(0, 128, 0));

	//Init button Ctrl
	m_hListSysFunctionInfo.InsertColumn(0, "系统功能", LVCFMT_CENTER, 400) ;
	m_hListSysFunctionInfo.SetExtendedStyle(m_hListSysFunctionInfo.GetStyle() | LVS_EX_FULLROWSELECT);

	m_hDatabase.ListSysFunctionInfoToCtrl(&m_hListSysFunctionInfo) ;
}

void CDlgSysFunctionInfo::OnBtnAdd() 
{
	// TODO: Add your control notification handler code here
	m_hEditSysFunctionInfo.SetWindowText("") ;
	m_hBtnSave.EnableWindow() ;
	m_hEditSysFunctionInfo.SetFocus() ;
}

void CDlgSysFunctionInfo::OnBtnDel() 
{
	// TODO: Add your control notification handler code here
	if(m_hListSysFunctionInfo.GetSelectionMark() == -1)
	{//未被选中
		MessageBox("请选择欲删除条目!") ;
		return ;
	}
	char m_szName[30+1] ;
	m_hListSysFunctionInfo.GetItemText(m_hListSysFunctionInfo.GetSelectionMark(), 0, m_szName, sizeof(m_szName)) ;
	m_hDatabase.DeleteDataWhere(SFI, m_szName) ;
	m_hDatabase.ListSysFunctionInfoToCtrl(&m_hListSysFunctionInfo) ;
}

void CDlgSysFunctionInfo::OnBtnSave() 
{
	// TODO: Add your control notification handler code here
	char m_szName[30+1] ;
	m_hEditSysFunctionInfo.GetWindowText(m_szName, sizeof(m_szName)) ;

	m_hDatabase.UpdateSysFunctionInfoData(m_szName) ;
	m_hBtnSave.EnableWindow(FALSE) ;

	m_hDatabase.ListSysFunctionInfoToCtrl(&m_hListSysFunctionInfo) ;
}

⌨️ 快捷键说明

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