RankPage.cpp
上传用户:hydatong
上传日期:2022-08-07
资源大小:219k
文件大小:2k
- // RankPage.cpp : implementation file
- //
- #include "stdafx.h"
- #include "fighter.h"
- #include "RankPage.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CRankPage property page
- IMPLEMENT_DYNCREATE(CRankPage, CPropertyPageEx)
- CRankPage::CRankPage() : CPropertyPageEx(CRankPage::IDD)
- {
- //{{AFX_DATA_INIT(CRankPage)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- }
- CRankPage::~CRankPage()
- {
- }
- void CRankPage::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPageEx::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CRankPage)
- DDX_Control(pDX, IDC_LIST_RANK, m_ctrlRank);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CRankPage, CPropertyPageEx)
- //{{AFX_MSG_MAP(CRankPage)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CRankPage message handlers
- BOOL CRankPage::OnInitDialog()
- {
- CPropertyPageEx::OnInitDialog();
-
- // TODO: Add extra initialization here
- DWORD dwStyle = GetWindowLong(m_ctrlRank.GetSafeHwnd(), GWL_STYLE);
- if((dwStyle&LVS_TYPEMASK) != LVS_REPORT){
- SetWindowLong(m_ctrlRank.GetSafeHwnd(),
- GWL_STYLE, (dwStyle&~LVS_TYPEMASK)|LVS_REPORT);
- }
- DWORD oldStyle = m_ctrlRank.GetExtendedStyle();
- m_ctrlRank.SetExtendedStyle(oldStyle |LVS_EX_FULLROWSELECT);
- m_ctrlRank.InsertColumn(0, " ", LVCFMT_CENTER, 25, 0);
- m_ctrlRank.InsertColumn(1, "姓名", LVCFMT_CENTER, 120, 0);
- m_ctrlRank.InsertColumn(2, "炮弹", LVCFMT_RIGHT, 50, 0);
- m_ctrlRank.InsertColumn(3, "命中率", LVCFMT_RIGHT, 60, 0);
- CString temp;
- int index;
- for(int i=0; i<10; i++)
- {
- temp.Format("%d", i+1);
- index = m_ctrlRank.InsertItem(i, temp);
- temp.Format("%s", m_strName[i]);
- m_ctrlRank.SetItemText(index, 1, temp);
- temp.Format("%d", m_nBomb[i]);
- m_ctrlRank.SetItemText(index, 2, temp);
- temp.Format("%2.1f%%", m_fHitPercentage[i]);
- m_ctrlRank.SetItemText(index, 3, temp);
- }
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }