📄 listboxdlg.cpp
字号:
// ListBoxDlg.cpp : implementation file
//
#include "stdafx.h"
#include "exam7_3.h"
#include "ListBoxDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CListBoxDlg dialog
CListBoxDlg::CListBoxDlg(CWnd* pParent /*=NULL*/)
: CDialog(CListBoxDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CListBoxDlg)
m_edit = _T("");
m_strList = _T("");
//}}AFX_DATA_INIT
}
void CListBoxDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CListBoxDlg)
DDX_Control(pDX, IDC_LIST1, m_ListBox);
DDX_Text(pDX, IDC_EDIT1, m_edit);
DDX_LBString(pDX, IDC_LIST1, m_strList);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CListBoxDlg, CDialog)
//{{AFX_MSG_MAP(CListBoxDlg)
ON_LBN_DBLCLK(IDC_LIST1, OnDblclkList1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CListBoxDlg message handlers
BOOL CListBoxDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_ListBox.AddString("Item01");
m_ListBox.AddString("Item02");
m_ListBox.AddString("Item03");
m_ListBox.AddString("Item04");
m_ListBox.AddString("Item05");
m_ListBox.AddString("Item06");
m_ListBox.AddString("Item07");
m_ListBox.AddString("Item08");
m_ListBox.AddString("Item09");
m_ListBox.AddString("Item10");
m_ListBox.AddString("Item11");
m_ListBox.AddString("Item12");
m_ListBox.SelectString(0,m_strList);
m_edit=m_strList;
UpdateData(false);
//m_ListBox.SetCurSel(m_ListItem);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CListBoxDlg::OnDblclkList1()
{
// TODO: Add your control notification handler code here
UpdateData(true);
m_edit=m_strList;
UpdateData(false);
}
void CListBoxDlg::OnOK()
{
// TODO: Add extra validation here
m_ListItem=m_ListBox.GetCurSel();
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -