예제 #1
0
        private void cmbWord_TextChanged(object sender, EventArgs e)
        {
            ComboBox cmb = (ComboBox)sender;
            CRecord  rec;
            int      index = _dic.FindWord(cmb.Text);

            if (index >= 0)
            {
                rec             = _dic[index];
                txtMeaning.Text = rec.Meaning.Replace("\n", "\r\n");
                _strCurrentWord = rec.Word;
            }

            int max = Math.Min(5, _dic.Count);

            cmbWord.Items.Clear();
            index = Math.Max(index + 1, 0);
            if (_dic.Count - index < max)
            {
                index = _dic.Count - max;
            }

            for (int i = index, count = 0; count < Math.Min(max, _dic.Count - index); count++)
            {
                rec = _dic[i + count];
                cmbWord.Items.Add(rec.Word);
            }
        }
예제 #2
0
        private void comboBox1_TextChanged(object sender, EventArgs e)
        {
            ComboBox cmb   = (ComboBox)sender;
            int      index = dic.FindWord(cmb.Text);

            if (index >= 0)
            {
                CRecord rec = dic[index];
                textBox1.Text = rec.Meaning;
            }
        }