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

📄 viewadmactiondlg.cpp

📁 初学VC,编写的一个机房管理系统,功能基本上完善,但代码可读性不强.
💻 CPP
字号:
// ViewAdmActionDlg.cpp : implementation file
//

#include "stdafx.h"
#include "server.h"
#include "ViewAdmActionDlg.h"
#include "admactionSet.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CString name;
/////////////////////////////////////////////////////////////////////////////
// CViewAdmActionDlg dialog


CViewAdmActionDlg::CViewAdmActionDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CViewAdmActionDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CViewAdmActionDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CViewAdmActionDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CViewAdmActionDlg)
	DDX_Control(pDX, IDC_LIST1, m_ListCtrl);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CViewAdmActionDlg, CDialog)
	//{{AFX_MSG_MAP(CViewAdmActionDlg)
		// NOTE: the ClassWizard will add message map macros here
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CViewAdmActionDlg message handlers

BOOL CViewAdmActionDlg::OnInitDialog()
{	
	CDialog::OnInitDialog();
	SetWindowText(name+"的操作记录");
	DWORD dwStyle;
	RECT rect;
	LV_COLUMN lvc;
	m_ListCtrl.SetBkColor(RGB(255,255,255));
	m_ListCtrl.SetTextBkColor(RGB(255,255,255));
	dwStyle = m_ListCtrl.GetStyle();
	dwStyle |= LVS_EX_GRIDLINES |LVS_EX_FULLROWSELECT |LVS_SHOWSELALWAYS |LVS_EDITLABELS ;

	m_ListCtrl.SetExtendedStyle(dwStyle);
	m_ListCtrl.GetClientRect(&rect);

	lvc.mask = LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH |LVCF_FMT;
	lvc.fmt=LVCFMT_LEFT;
	lvc.iSubItem = 0;
	lvc.pszText = _T("日	期");
	lvc.cx = 250;
	
	m_ListCtrl.InsertColumn(1,&lvc);

	lvc.iSubItem = 1;
	lvc.pszText = _T("操	作");
	lvc.cx = 200;
	m_ListCtrl.InsertColumn(2,&lvc);
	LV_ITEM lvitem;
	int numline=0;
	lvitem.pszText="";
	lvitem.mask=LVIF_TEXT;
	lvitem.iSubItem=0;
	CString *pname;
	pname= new CString;
	pname->Format("name='%s'",name);
	CAdmactionSet admaction;
	admaction.m_strFilter=*pname;
	admaction.Open();
	while(!admaction.IsEOF())
	{		
			
			lvitem.iItem=numline;
			m_ListCtrl.InsertItem(&lvitem);
			m_ListCtrl.SetItemText(numline,0,admaction.m_date);
			m_ListCtrl.SetItemText(numline,1,admaction.m_action);
			numline++;
			admaction.MoveNext();
				
	}
	admaction.Close();
	return FALSE;

}

⌨️ 快捷键说明

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