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

📄 scoredlg.cpp

📁 我上载了那么多怎么都说已经有上载的啦
💻 CPP
字号:
// ScoreDlg.cpp : implementation file
//

#include "stdafx.h"
#include "gpmis.h"
#include "ScoreDlg.h"
#include "ScoreView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CScoreDlg dialog
#define NUM1_COLUMNS	7
static _TCHAR *_gszLabel1[NUM1_COLUMNS] =
{
    _T("项目"), _T("90分以上"), _T("80-89分"), _T("70-79分"), _T("60-69分"), _T("60分以下"), _T("延期答辩")
};
static int _gnFmt1[NUM1_COLUMNS] = 
{
	LVCFMT_LEFT, LVCFMT_CENTER , LVCFMT_CENTER , LVCFMT_CENTER , LVCFMT_CENTER , LVCFMT_CENTER , LVCFMT_CENTER 
};
static int _gnWidth1[NUM1_COLUMNS] = 
{
	50, 66, 64, 64, 64, 66, 64
};

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


void CScoreDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CScoreDlg)
	DDX_Control(pDX, IDC_SCORE_LIST, m_lvwScore);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CScoreDlg, CDialog)
	//{{AFX_MSG_MAP(CScoreDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CScoreDlg message handlers

BOOL CScoreDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	HICON hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
	SetIcon(hIcon, TRUE);	// Set big icon
	SetIcon(hIcon, FALSE);// Set small icon
	
	// TODO: Add extra initialization here
	DrawLabel();
	DrawList();
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CScoreDlg::DrawLabel()
{
	int i;
	LV_COLUMN lvc;

	// delete columns
	int sum = NUM1_COLUMNS;
	_TCHAR **szLabel = _gszLabel1;
	int *nWidth = _gnWidth1;
	int *nFmt = _gnFmt1;
	for(i = 0; i<sum; i++)
	{
		m_lvwScore.DeleteColumn(0);
	}
	// insert columns
	lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;

	for(i = 0; i<sum; i++)
	{
		lvc.iSubItem = i;
		lvc.pszText = szLabel[i];
		lvc.cx = nWidth[i];
		lvc.fmt = nFmt[i];
		m_lvwScore.InsertColumn(i,&lvc);
	}

	m_lvwScore.SetExtendedStyle(LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT);
	m_lvwScore.EnableToolTips(TRUE);


}

void CScoreDlg::DrawList()
{
	LV_ITEM lvi;
	int i = 0;
	char cNum[100];

	// delete list items
	m_lvwScore.DeleteAllItems();

	lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
	lvi.iSubItem = 0;
	lvi.iImage = 0;
	lvi.stateMask = LVIS_STATEIMAGEMASK;
	lvi.state = INDEXTOSTATEIMAGEMASK(1);

	i = 0;
	sprintf(cNum,"数量");
	lvi.iItem = i;
	lvi.pszText = (LPTSTR)cNum;
	m_lvwScore.InsertItem(&lvi);

	CString strTemp;
	for(int j = 0; j < 6; j++)
	{
		strTemp.Format("%d",m_pScoreView->m_nScoreSum[j]);
		m_lvwScore.SetItemText(i, j+1, strTemp);
	}

	i = 1;
	sprintf(cNum,"百分比");
	lvi.iItem = i;
	lvi.pszText = (LPTSTR)cNum;
	m_lvwScore.InsertItem(&lvi);
	for( j = 0; j < 5; j++)
	{
		strTemp.Format("%d%%",int((float)(m_pScoreView->m_nScoreSum[j]*100)/float(m_pScoreView->m_nSum) + 0.5));
		m_lvwScore.SetItemText(i, j+1, strTemp);
	}

	i = 2;
	sprintf(cNum,"");
	lvi.iItem = i;
	lvi.pszText = (LPTSTR)cNum;
	m_lvwScore.InsertItem(&lvi);

	i = 3;
	sprintf(cNum,"总人数");
	lvi.iItem = i;
	lvi.pszText = (LPTSTR)cNum;
	m_lvwScore.InsertItem(&lvi);
	strTemp.Format("%d",m_pScoreView->m_nSum);
	m_lvwScore.SetItemText(i, 1, strTemp);

	strTemp.Format("通过人数");
	m_lvwScore.SetItemText(i, 3, strTemp);
	
	strTemp.Format("%d",m_pScoreView->m_nSum - m_pScoreView->m_nScoreSum[4] - m_pScoreView->m_nScoreSum[5]);
	m_lvwScore.SetItemText(i, 4, strTemp);

}

⌨️ 快捷键说明

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