private void cboAeroRefEnv_SelectionChangeCommitted(object sender, EventArgs e) { ComboBox cbo = sender as ComboBox; string strRefEnv = cbo.SelectedItem.ToString(); if (strRefEnv == "自定义") { if (DialogResult.OK != groParaBox.ShowDialog(this)) { Match mch = Regex.Match(TipShow.GetToolTip(cboAeroRefEnv), @"^[\u4e00-\u9fa5]+"); cboAeroRefEnv.Text = mch.Groups[0].Value; } } }
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; } }