edit control的一个例子

来源:互联网 发布:js跨域解决方案c# 编辑:程序博客网 时间:2024/05/22 15:06
C++代码
BOOL CExample21Dlg::OnInitDialog()
{
CDialogEx::OnInitDialog();

// Add "About..." menu item to system menu.

// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);

CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
BOOL bNameValid;
CString strAboutMenu;
bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
ASSERT(bNameValid);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}

// 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

// TODO: Add extra initialization here
m_editMultiLine.SetWindowText(_T("鸡啄米博客/software")); // 设置编辑框正文为“鸡啄米博客.com”
m_editMultiLine.SetSel(3, 5); // 选择起始索引为3,终止索引为5(不包括在选择范围内)的正文,即“博客”
m_editMultiLine.ReplaceSel(_T("\r\nwww.jizhuomi.com")); // 将选择的“博客”替换为“\r\nwww.jizhuomi.com”

return TRUE; // return TRUE unless you set the focus to a control
}
0 0
原创粉丝点击