private void TxtMailAddress_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\b')
            {
                string[] strTemp = TxtMailAddress.Text.Trim().Split('@');

                TxtMailAddress.Text = strTemp[0];

                //光标定位到最后
                TxtMailAddress.Select(TxtMailAddress.Text.Length, 1);
            }
        }
Esempio n. 2
0
        private void TxtMailAddress_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\b')
            {
                string[] strTemp = TxtMailAddress.Text.Trim().Split('@');

                TxtMailAddress.Text = strTemp[0];

                //光标定位到最后
                TxtMailAddress.Select(TxtMailAddress.Text.Length, 1);
            }
            if (e.KeyChar == (char)Keys.Enter)
            {
                TxtMailAddress.Text    = LstMailAddress.Items[0].ToString();
                LstMailAddress.Visible = false;

                //光标定位到最后
                TxtMailAddress.Select(TxtMailAddress.Text.Length, 1);
            }
        }