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

📄 dlgtext.cpp

📁 用户管理系统
💻 CPP
字号:
// DlgText.cpp : implementation file
//

#include "stdafx.h"
#include "Kvip.h"
#include "DlgText.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDlgText dialog


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


void CDlgText::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgText)
	DDX_Control(pDX, IDC_MASTER, m_Master);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// CDlgText message handlers

BOOL CDlgText::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
int i;
	int total_cx = 0;
	LV_COLUMN lvcolumn;
	CRect rect;
	m_Master.GetWindowRect(&rect);
    int w = rect.Width() - 2;
	int colwidths[6] = { 8, 14, 12, 9, 8, 13 };	// sixty-fourths

	memset(&lvcolumn, 0, sizeof(lvcolumn));
	TCHAR *	lpszHeaders[] = { _T("Enable"),
							  _T("Some Text"),
							  _T("Item"),
							  _T("Pct"),
							  _T("Status"),
							  _T("Some More Text"),
							  NULL };

	// add columns
	for (i = 0; ; i++)
	{
		if (lpszHeaders[i] == NULL)
			break;

		lvcolumn.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH;
		lvcolumn.fmt = (i == 1 || i == 5) ? LVCFMT_LEFT : LVCFMT_CENTER;
		lvcolumn.pszText = lpszHeaders[i];
		lvcolumn.iSubItem = i;
		lvcolumn.cx = (lpszHeaders[i+1] == NULL) ? w - total_cx - 2 : (w * colwidths[i]) / 64;
		total_cx += lvcolumn.cx;
		m_Master.InsertColumn(i, &lvcolumn);
	}

	int nItem, nSubItem;
	CString str;
	for (nItem = 0; nItem < 10; nItem++)
	{
		for (nSubItem = 0; nSubItem < 6; nSubItem++)
		{
			if (nSubItem == 0)			// checkbox
				str = _T("aaa");
			m_Master.InsertItem(nItem, str);
		}
	}
	DWORD dwStype = m_Master.GetExtendedStyle();
	dwStype |= LVS_EX_CHECKBOXES;
    m_Master.SetExtendedStyle(dwStype);
	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 + -