【VC开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学会员整理了VC开源代码-DlgSysFunctionInfo.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) ;
}
上一篇:
frmCheckSel.frm
下一篇:
基于消费者社会化视角的儿童消费者影响因素研究