zoukankan      html  css  js  c++  java
  • C++ Combobox输入时自动完成

     

    Combobox 在输入时自动完成

     

    关键点

     

     

    实现过程

     

     

    BOOL m_bAuto;
    BOOL CProject02Dlg::PreTranslateMessage(MSG* pMsg
    {
        if (pMsg->message == WM_KEYDOWN)
        {
            int nChar = pMsg->wParam;
            if ((nChar == VK_DELETE) || (nChar == VK_BACK))
            {
                m_bAuto = FALSE;
            }
            else
            {
                m_bAuto = TRUE;
            }
        }
        return CDialog::PreTranslateMessage(pMsg);
    }
    void CProject02Dlg::OnEditchangeCombo1() 
    {
        if (!m_bAuto)
        {
            return;
        }    
        CString strText = _T("");
        m_combobox1.GetWindowText(strText);
        int nLength = strText.GetLength();
        int nIndex = m_combobox1.FindString(-1strText);
        if (nIndex != CB_ERR)
        {
            m_combobox1.SetCurSel(nIndex);
            m_combobox1.SetEditSel(nLength, -1);
        }
    }

     

     

       


     

    备注

     

     

    相关链接

                               

     

     




    附件列表

    • 相关阅读:
      104. 二叉树的最大深度
      1120. 子树的最大平均值
      1121. 将数组分成几个递增序列
      1118. 一月有多少天
      1110. 删点成林
      102. 二叉树的层次遍历
      145. 二叉树的后序遍历
      94. 二叉树的中序遍历
      144. 二叉树的前序遍历
      剑指offer-0x04
    • 原文地址:https://www.cnblogs.com/xe2011/p/3576965.html
    Copyright © 2011-2022 走看看