📄 information.cpp
字号:
// Information.cpp : implementation file
//
#include "stdafx.h"
#include "Chat.h"
#include "Information.h"
#include "Global.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CFederate Fed;
/////////////////////////////////////////////////////////////////////////////
// CInformation dialog
CInformation::CInformation(CWnd* pParent /*=NULL*/)
: CDialog(CInformation::IDD, pParent)
{
//{{AFX_DATA_INIT(CInformation)
//}}AFX_DATA_INIT
}
void CInformation::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CInformation)
DDX_Control(pDX, IDC_LIST1, m_List);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CInformation, CDialog)
//{{AFX_MSG_MAP(CInformation)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CInformation message handlers
BOOL CInformation::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
//添加标题
m_List.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
m_List.InsertColumn(0, _T("用户名"), LVCFMT_LEFT, 80);
m_List.InsertColumn(1, _T("姓名"), LVCFMT_LEFT, 80);
m_List.InsertColumn(2, _T("年龄"), LVCFMT_LEFT, 80);
unsigned long numOfData = 0;
char* charbuffer = NULL;
CString user_name,real_name;
//读取聊天者信息进行显示
for(int i=0;i<Fed.m_Sub_Persons.GetSize();i++)
{
numOfData = Fed.m_Sub_Persons[i]->m_user_name.size();
charbuffer = new char[numOfData + 1];
memset(charbuffer, 0, numOfData + 1);
Fed.m_Sub_Persons[i]->m_user_name.copy(charbuffer, numOfData);
user_name = charbuffer;
m_List.InsertItem(0, user_name);
numOfData = Fed.m_Sub_Persons[i]->m_real_name.size();
charbuffer = new char[numOfData + 1];
memset(charbuffer, 0, numOfData + 1);
Fed.m_Sub_Persons[i]->m_real_name.copy(charbuffer, numOfData);
real_name = charbuffer;
m_List.SetItemText(0,1,real_name);
CString age;
age.Format("%d",Fed.m_Sub_Persons[i]->m_age);
m_List.SetItemText(0,2,age);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -