private void txtFileExist_TextChanged(object sender, EventArgs e) { TextBox txt = sender as TextBox; TipShow.SetToolTip(txt, txt.Text); if (!txt.Focused) { txt.SelectionStart = txt.Text.Length; } Match mch = Regex.Match(txt.Text, chanRegex, RegexOptions.IgnoreCase); errorShow.SetError(txt, null); if (!mch.Groups[0].Success || !File.Exists(txt.Text)) { btnCfgOk.Enabled = false; errorShow.SetError(txt, "文件不存在"); } else { btnCfgOk.Enabled = true; } }