📄 admactordlg.cpp
字号:
// AdmActorDlg.cpp : implementation file
//
#include "stdafx.h"
#include "tvnews.h"
#include "AdmActorDlg.h"
#include "Role.h"
#include "ActorInfDlg.h"
#include "StyleList.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAdmActorDlg dialog
CAdmActorDlg::CAdmActorDlg(CWnd* pParent /*=NULL*/)
: CDialog(CAdmActorDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CAdmActorDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CAdmActorDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAdmActorDlg)
DDX_Control(pDX, IDC_LIST1, m_RoleList);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAdmActorDlg, CDialog)
//{{AFX_MSG_MAP(CAdmActorDlg)
ON_NOTIFY(NM_CLICK, IDC_LIST1, OnClickList1)
ON_BN_CLICKED(IDC_BTNUPDATE_RINFO, OnBtnupdateEdt)
ON_WM_SHOWWINDOW()
ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAdmActorDlg message handlers
BOOL CAdmActorDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_RoleList.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
m_RoleList.InsertColumn(0,_T(""));
m_RoleList.SetColumnWidth(0,0);
m_RoleList.InsertColumn(1,_T("角色名称"));
m_RoleList.SetColumnWidth(1,100);
m_RoleList.InsertColumn(2,_T("描述"));
m_RoleList.SetColumnWidth(2,1000);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CAdmActorDlg::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
//-- Get the number of selected rows
int nSelRows = m_RoleList.GetSelectedCount();
if(!nSelRows) //-- If there are no rows selected,jump out here
return;
//-- Get the position of the first selected row
POSITION pos =m_RoleList.GetFirstSelectedItemPosition();
//-- Get the index of next selected row
int i = m_RoleList.GetNextSelectedItem(pos);
if (i != -1) //-- Execute this loop as long as GetNextSelectedItem() returns -1
{
selectID= atoi(m_RoleList.GetItemText(i, 0));
}
*pResult = 0;
return;
}
void CAdmActorDlg::OnBtnupdateEdt()
{
// TODO: Add your control notification handler code here
if(m_RoleList.GetSelectedCount()==0)
{
MessageBox("请选择要编辑的行!");
return;
}
CActorInfDlg ActorInfDlg;
ActorInfDlg.Type=1;
ActorInfDlg.iUID=selectID;
ActorInfDlg.DoModal();
CRole Role;
Role.ShowList(m_RoleList);
}
void CAdmActorDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
CDialog::OnShowWindow(bShow, nStatus);
// TODO: Add your message handler code here
CRole Role;
Role.ShowList(m_RoleList);
}
void CAdmActorDlg::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
int nSelRows = m_RoleList.GetSelectedCount();
if(!nSelRows) //-- If there are no rows selected,jump out here
return;
//-- Get the position of the first selected row
POSITION pos =m_RoleList.GetFirstSelectedItemPosition();
//-- Get the index of next selected row
int i = m_RoleList.GetNextSelectedItem(pos);
if (i != -1) //-- Execute this loop as long as GetNextSelectedItem() returns -1
{
selectID= atoi(m_RoleList.GetItemText(i, 0));
}
CActorInfDlg ActorInfDlg;
ActorInfDlg.Type=1;
ActorInfDlg.iUID=selectID;
ActorInfDlg.DoModal();
CRole Role;
Role.ShowList(m_RoleList);
*pResult = 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -