testdoclistcombodlg.cpp
来自「windows ce开发技巧与实例光盘代码」· C++ 代码 · 共 93 行
CPP
93 行
// TestDocListComboDlg.cpp : implementation file
//
#include "stdafx.h"
#include "TestDocListCombo.h"
#include "TestDocListComboDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTestDocListComboDlg dialog
CTestDocListComboDlg::CTestDocListComboDlg(CWnd* pParent /*=NULL*/)
: CDialog(CTestDocListComboDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CTestDocListComboDlg)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CTestDocListComboDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTestDocListComboDlg)
DDX_Control(pDX, IDC_LIST1, m_ctrlListBox);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CTestDocListComboDlg, CDialog)
//{{AFX_MSG_MAP(CTestDocListComboDlg)
ON_COMMAND(ID_SHOW_LETTERS, OnShowLetters)
ON_COMMAND(ID_SHOW_NUMBERS, OnShowNumbers)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTestDocListComboDlg message handlers
BOOL CTestDocListComboDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
CenterWindow(GetDesktopWindow()); // center to the hpc screen
CRect rect;
GetClientRect(rect);
m_ctrlDocListCombo.Create(
TEXT(""),
WS_CHILD | WS_VISIBLE,
CRect(rect.left, rect.top, rect.right, rect.top + 22),
this,
11);
OnShowLetters();
VERIFY(m_ctrlDocListCombo.SetDropDownMenu(IDR_MENUBAR1));
m_ctrlDocListCombo.SetTitleText(TEXT("Show"));
return TRUE; // return TRUE unless you set the focus to a control
}
void CTestDocListComboDlg::OnShowLetters()
{
m_ctrlDocListCombo.SetSelectedText("Letters");
m_ctrlListBox.ResetContent();
m_ctrlListBox.InsertString(0, TEXT("A"));
m_ctrlListBox.InsertString(1, TEXT("B"));
m_ctrlListBox.InsertString(2, TEXT("C"));
m_ctrlListBox.InsertString(3, TEXT("D"));
m_ctrlListBox.InsertString(4, TEXT("E"));
m_ctrlListBox.InsertString(5, TEXT("F"));
}
void CTestDocListComboDlg::OnShowNumbers()
{
m_ctrlDocListCombo.SetSelectedText("Digits");
m_ctrlListBox.ResetContent();
m_ctrlListBox.InsertString(0, TEXT("1"));
m_ctrlListBox.InsertString(1, TEXT("2"));
m_ctrlListBox.InsertString(2, TEXT("3"));
m_ctrlListBox.InsertString(3, TEXT("4"));
m_ctrlListBox.InsertString(4, TEXT("5"));
m_ctrlListBox.InsertString(5, TEXT("6"));
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?