Пример #1
0
        //修改磁贴名称的点击ok按钮事件
        public void BtnOkClickForRePlaceName(FormInputBox frm)
        {
            string text = frm.txtInput.Text;

            string[] errorStrs = { "\\", "/", ":", "*", "\"", "<", ">", "|" };

            string allErrorStr = null;

            foreach (var str in errorStrs)
            {
                allErrorStr += (str + " ");
            }

            foreach (var str in errorStrs)
            {
                if (text.Contains(str))
                {
                    MessageBox.Show("请勿输入以下文件名中不支持的字符\n" + allErrorStr, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
            }

            if (text == string.Empty)
            {
                MessageBox.Show("不能为空", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            txtNameView.Text = text;
            frm.Dispose();
        }
Пример #2
0
        //输入HTML颜色代码的点击ok按钮事件
        public void BtnOkClickForInputHTMLCode(FormInputBox frm)
        {
            string text = frm.txtInput.Text;

            try {
                //考虑到用户懒惰行为:不输入#,不带#的纯数字解析值不同
                text = "#" + text;
                ColorTranslator.FromHtml(text);
            }
            catch (Exception) {
                try {
                    text = frm.txtInput.Text;
                    ColorTranslator.FromHtml(text);
                }
                catch (Exception) {
                    MessageBox.Show("请输入正确的HTML颜色代码", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
            }
            if (text == string.Empty)
            {
                MessageBox.Show("不能为空", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                picColorView.BackColor = ColorTranslator.FromHtml(text);
                frm.Dispose();
            }
        }
Пример #3
0
        //输入HTML颜色代码的点击ok按钮事件
        private void BtnOkClickForInputHTMLCode(FormInputBox frm)
        {
            string text = frm.txtInput.Text;

            try
            {
                //考虑到用户懒惰行为:不输入#,不带#的纯数字解析值不同
                text = "#" + text;
                ColorTranslator.FromHtml(text);
            }
            catch (Exception)
            {
                try
                {
                    text = frm.txtInput.Text;
                    ColorTranslator.FromHtml(text);
                }
                catch (Exception)
                {
                    new FormMyMessageBox("请输入正确的HTML颜色代码").Show();
                    return;
                }
            }
            picColorView.BackColor = ColorTranslator.FromHtml(text);
            frm.Dispose();
        }
Пример #4
0
        //输入url链接点击ok按钮事件
        private void BtnOkClickForInputUrl(FormInputBox frm)
        {
            string text = frm.txtInput.Text;

            if (text == string.Empty)
            {
                MessageBox.Show("不能为空", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                urlPath = text;
                frm.Dispose();
            }
        }
Пример #5
0
        //修改磁贴名称的点击ok按钮事件
        private void BtnOkClickForRePlaceName(FormInputBox frm)
        {
            string text = frm.txtInput.Text;

            string[] errorStrs = { "\\", "/", ":", "*", "\"", "<", ">", "|" };

            string allErrorStr = null;

            foreach (var str in errorStrs)
            {
                allErrorStr += (str + " ");
            }

            foreach (var str in errorStrs)
            {
                if (text.Contains(str))
                {
                    new FormMyMessageBox("请勿输入以下文件名中不支持的字符\n" + allErrorStr).Show();
                    return;
                }
            }
            txtNameView.Text = text;
            frm.Dispose();
        }
Пример #6
0
 //输入url链接点击ok按钮事件
 private void BtnOkClickForInputUrl(FormInputBox frm)
 {
     urlPath = frm.txtInput.Text;
     frm.Dispose();
 }