【VC开源代码栏目提醒】:网学会员为需要VC开源代码的朋友们搜集整理了DlgRoleinfo.cpp相关资料,希望对各位网友有所帮助!
// DlgRoleinfo.cpp : implementation file
//
#include "stdafx.h"
#include "MerchandiseStore.h"
#include "DlgRoleinfo.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
/////////////////////////////////////////////////////////////////////////////
// CDlgRoleinfo dialog
CDlgRoleinfo::CDlgRoleinfo(CWnd* pParent /*=NULL*/)
: CDialog(CDlgRoleinfo::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgRoleinfo)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CDlgRoleinfo::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgRoleinfo)
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_ROLEINFO, m_hListRoleinfo);
DDX_Control(pDX, IDC_EDIT_ROLEINFO, m_hEditRoleinfo);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgRoleinfo, CDialog)
//{{AFX_MSG_MAP(CDlgRoleinfo)
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()
/////////////////////////////////////////////////////////////////////////////
// CDlgRoleinfo message handlers
BOOL CDlgRoleinfo::OnInitDialog()
{
CDialog::OnInitDialog();
InitCtrlData() ;
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDlgRoleinfo::OnBtnAdd()
{
// TODO: Add your control notification handler code here
m_hEditRoleinfo.SetWindowText("") ;
m_hBtnSave.EnableWindow() ;
m_hEditRoleinfo.SetFocus() ;
}
void CDlgRoleinfo::OnBtnDel()
{
// TODO: Add your control notification handler code here
if(m_hListRoleinfo.GetSelectionMark() == -1)
{//未被选中
MessageBox("请选择欲删除条目!") ;
return ;
}
char m_szName[30+1] ;
m_hListRoleinfo.GetItemText(m_hListRoleinfo.GetSelectionMark(), 0, m_szName, sizeof(m_szName)) ;
m_hDatabase.DeleteDataWhere(RI, m_szName) ;
m_hDatabase.ListRoleInfoToCtrl(&m_hListRoleinfo) ;
}
void CDlgRoleinfo::OnBtnSave()
{
// TODO: Add your control notification handler code here
char m_szName[30+1] ;
m_hEditRoleinfo.GetWindowText(m_szName, sizeof(m_szName)) ;
m_hDatabase.UpdateRoleinfoData(m_szName) ;
m_hBtnSave.EnableWindow(FALSE) ;
m_hDatabase.ListRoleInfoToCtrl(&m_hListRoleinfo) ;
}
void CDlgRoleinfo::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_hListRoleinfo.InsertColumn(0, "角色信息", LVCFMT_CENTER, 400) ;
m_hListRoleinfo.SetExtendedStyle(m_hListRoleinfo.GetStyle() | LVS_EX_FULLROWSELECT);
m_hDatabase.ListRoleInfoToCtrl(&m_hListRoleinfo) ;
}
上一篇:
DlgRkQuery.cpp
下一篇:
如何当一个轻松的班主任