Visual C++ - CListCtrl Full Row Select Option With LVS_EX_FULLROWSELECT
We might be using CListCtrl a lot in Visual C++ project. It is often necessary to have the full row select option instead of a single cell. It is very easy to do it. Look at the following code and how it is used in the sample project.
Source Code
// StudentInformationSystemDlg.cpp : implementation file
//
void CStudentInformationSystemDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_LIST1, m_listCtrl);
}
BOOL CStudentInformationSystemDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_listCtrl.SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);
return TRUE; // return TRUE unless you set the focus to a control
}
Click here to download the VS 2005 Project file and executable
Output
|