예제 #1
0
 //-----------------------------------------------------
 public CMotVocabulaire GetVocabulaire(string strRacine)
 {
     if (strRacine == "")
     {
         return(this);
     }
     if (strRacine.IndexOf('.') >= 0)
     {
         string          strLeft  = strRacine.Substring(0, strRacine.IndexOf('.'));
         string          strRight = strRacine.Substring(strRacine.IndexOf('.') + 1);
         CMotVocabulaire mot      = (CMotVocabulaire)m_tableMots[strLeft.ToUpper()];
         if (mot != null)
         {
             return(mot.GetVocabulaire(strRight));
         }
         return(null);
     }
     return(this);
 }
예제 #2
0
        private void FillListBox( )
        {
            int nPosInText = m_textBox.SelectionStart;

            ListBox.Items.Clear();
            int    nWidth  = 100;
            string strWord = GetLastWord(m_strSeparateurs);

            if (Vocabulaire == null)
            {
                return;
            }
            CMotVocabulaire vocab   = Vocabulaire.GetVocabulaire(strWord);
            ArrayList       lstMots = new ArrayList();

            if (vocab != null)
            {
                if (!vocab.IsInit)
                {
                    FillWithFields(vocab);
                }
                //Trouve la fin du mot
                int nLastIndex = strWord.LastIndexOf('.');
                if (nLastIndex > 0)
                {
                    strWord = strWord.Substring(nLastIndex + 1);
                }
                lstMots = vocab.GetMots(strWord);
            }
            foreach (CMotVocabulaire mot in lstMots)
            {
                string strVoc = mot.ToString();
                ListBox.Items.Add(mot);
                nWidth = (int)Math.Min(Math.Max(nWidth, strVoc.Length * ListBox.Font.Size / 1.5), 400);
            }
            ListBox.Width = nWidth;
        }