Beispiel #1
0
        public override bool LeaveValidate()
        {
            foreach (Control control in Controls)
            {
                string curText = "";
                bool   bErroe  = false;
                Type   type    = control.GetType();
                if (type == typeof(ComboBox))
                {
                    ComboBox cmb = (ComboBox)control;
                    curText = cmb.Text;
                    switch (cmb.Name)
                    {
                    case "cb_TextSimilar":
                        bErroe = CssResources.CheckValue(TEXT_ALIGN, curText, false);
                        break;

                    case "cb_Space":
                        bErroe = CssResources.CheckValue(WHITE_SPACE, curText, false);
                        break;

                    case "cb_Show":
                        bErroe = CssResources.CheckValue(DISPLAY, curText, false);
                        break;

                    default:
                        break;
                    }
                    if (bErroe)
                    {
                        if (!CssUtility.ShowNotStandard(curText))
                        {
                            control.Focus();
                            return(false);
                        }
                    }
                }
                else if (type == typeof(CssFieldUnit))
                {
                    CssFieldUnit cfu = (CssFieldUnit)control;
                    curText = cfu.Value;
                    if (!string.IsNullOrEmpty(curText))
                    {
                        if (!cfu.CheckValue())
                        {
                            control.Focus();
                            return(false);
                        }
                    }
                }
            }
            SaveCssValue();
            return(base.LeaveValidate());
        }
Beispiel #2
0
        public override bool LeaveValidate()
        {
            #region 写入当前值
            //类型
            CssResourceList list = CssResources.Resources["position"];
            string          str  = cmbPosition.Text;
            if (list.HasValue(str))
            {
                str = list.GetValue(str);
            }
            Value.Properties["position"] = str;
            //浮动
            list = CssResources.Resources["float"];
            str  = cmbFloat.Text;
            if (list.HasValue(str))
            {
                str = list.GetValue(str);
            }
            Value.Properties["float"] = str;
            //显示
            list = CssResources.Resources["visibility"];
            str  = cmbVisibility.Text;
            if (list.HasValue(str))
            {
                str = list.GetValue(str);
            }
            Value.Properties["visibility"] = str;
            //Z轴
            list = CssResources.Resources["z-index"];
            str  = cmbZindex.Text;
            if (list.HasValue(str))
            {
                str = list.GetValue(str);
            }
            Value.Properties["z-index"] = str;
            //溢出
            list = CssResources.Resources["overflow"];
            str  = cmbOverflow.Text;
            if (list.HasValue(str))
            {
                str = list.GetValue(str);
            }
            Value.Properties["overflow"] = str;
            //清除
            list = CssResources.Resources["clear"];
            str  = cmbClear.Text;
            if (list.HasValue(str))
            {
                str = list.GetValue(str);
            }
            Value.Properties["clear"] = str;

            //宽度
            if (!WidthAuto)
            {
                Value.Properties["width"] = cssWidth.Value;
            }
            //高度
            if (!HeightAuto)
            {
                Value.Properties["height"] = cssHeight.Value;
            }
            //上
            Value.Properties["top"] = cssTop.Value;
            //右
            Value.Properties["right"] = cssRight.Value;
            //下
            Value.Properties["bottom"] = cssBottom.Value;
            //左
            Value.Properties["left"] = cssLeft.Value;
            //剪辑rect(auto,123px,123px,123px)
            string clip1 = "auto";
            string clip2 = "auto";
            string clip3 = "auto";
            string clip4 = "auto";
            if (string.IsNullOrEmpty(cssClipTop.Value) && string.IsNullOrEmpty(cssClipRight.Value) && string.IsNullOrEmpty(cssClipBottom.Value) && string.IsNullOrEmpty(cssClipLeft.Value))
            {
                Value.Properties["clip"] = "";
            }
            else
            {
                if (!string.IsNullOrEmpty(cssClipTop.Value))
                {
                    clip1 = cssClipTop.Value;
                }
                if (!string.IsNullOrEmpty(cssClipRight.Value))
                {
                    clip2 = cssClipRight.Value;
                }
                if (!string.IsNullOrEmpty(cssClipBottom.Value))
                {
                    clip3 = cssClipBottom.Value;
                }
                if (!string.IsNullOrEmpty(cssClipLeft.Value))
                {
                    clip4 = cssClipLeft.Value;
                }
                Value.Properties["clip"] = "rect(" + clip1 + "," + clip2 + "," + clip3 + "," + clip4 + ")";
            }

            #endregion

            foreach (Control control in Controls)
            {
                string curText = "";
                string cssName = "";
                Type   type    = control.GetType();
                if (type == typeof(ComboBox))
                {
                    #region  拉框
                    ComboBox cmb = (ComboBox)control;
                    curText = cmb.Text;
                    bool _isError = false;
                    switch (cmb.Name)
                    {
                    case "cmbPosition":
                        cssName  = "position";
                        _isError = CssResources.CheckValue(cssName, curText, false);
                        break;

                    case "cmbFloat":
                        cssName  = "float";
                        _isError = CssResources.CheckValue(cssName, curText, false);
                        break;

                    case "cmbVisibility":
                        cssName  = "visibility";
                        _isError = CssResources.CheckValue(cssName, curText, false);
                        break;

                    case "cmbZindex":
                        cssName = "z-index";
                        double d = 0;
                        if (curText == "(值)")
                        {
                            CssUtility.ShowReplaceMsg(curText);
                            cmb.Focus();
                            return(false);
                        }
                        if (curText != "自动" && curText != "auto" && !string.IsNullOrEmpty(curText) && !Double.TryParse(curText, out d))
                        {
                            _isError = true;
                        }
                        else
                        {
                            _isError = false;
                        }
                        break;

                    case "cmbOverflow":
                        cssName  = "overflow";
                        _isError = CssResources.CheckValue(cssName, curText, false);
                        break;

                    case "cmbClear":
                        cssName  = "clear";
                        _isError = CssResources.CheckValue(cssName, curText, false);
                        break;

                    default:
                        break;
                    }
                    if (_isError)
                    {
                        if (!CssUtility.ShowNotStandard(curText))
                        {
                            cmb.Focus();
                            return(false);
                        }
                    }
                    #endregion
                }
                if (type == typeof(GroupBox))
                {
                    foreach (Control item in control.Controls)
                    {
                        if (item.GetType() == typeof(CssFieldUnit))
                        {
                            #region 数值单位型
                            CssFieldUnit cfu = (CssFieldUnit)item;
                            curText = cfu.Value;
                            cssName = cfu.Name;
                            if (!cfu.CheckValue())
                            {
                                cfu.SelectFirst();
                                return(false);
                            }
                            #endregion
                        }
                    }
                }
            }

            return(base.LeaveValidate());
        }
Beispiel #3
0
        public override bool LeaveValidate()
        {
            foreach (Control control in Controls)
            {
                string curText = "";
                bool   bErroe  = false;
                Type   type    = control.GetType();
                if (type == typeof(ComboBox))
                {
                    ComboBox cmb = (ComboBox)control;
                    curText = cmb.Text;
                    switch (cmb.Name)
                    {
                    case "cb_FontThick":     //粗细
                        bErroe = CssResources.CheckValue(FONT_WEIGHT, curText, false);
                        break;

                    case "cb_Anamorphosis":    //变体
                        bErroe = CssResources.CheckValue(FONT_VARIANT, curText, false);
                        break;

                    case "cb_FontMode":    //样式
                        bErroe = CssResources.CheckValue(FONT_STYLE, curText, false);
                        break;

                    case "cb_CapsLock":    //大小写
                        bErroe = CssResources.CheckValue(TEXT_TRANSFORM, curText, false);
                        break;

                    default:
                        break;
                    }
                    if (bErroe)
                    {
                        if (!CssUtility.ShowNotStandard(curText))
                        {
                            control.Focus();
                            return(false);
                        }
                    }
                }
                else if (type == typeof(CssFieldUnit))
                {
                    CssFieldUnit cfu = (CssFieldUnit)control;
                    curText = cfu.Value;
                    if (!string.IsNullOrEmpty(curText))
                    {
                        if (!cfu.CheckValue())
                        {
                            control.Focus();
                            return(false);
                        }
                    }
                }
                else if (type == typeof(ColorTextBoxButton))
                {
                    curText = colorText_FontClolor.ColorText;
                    if (!this.colorText_FontClolor.CheckColor)
                    {
                        CssUtility.ShowNotStandardColorMsg(curText);
                        control.Focus();
                        return(false);
                    }
                }
            }
            SaveCssValue();
            return(base.LeaveValidate());
        }
Beispiel #4
0
        public override bool LeaveValidate()
        {
            #region 写入Css值

            CssResourceList list = CssResources.Resources["borderStyle"];
            if (WidthAuto)
            {
                Value.Properties["padding-right"] = cssPaddingRight.Value;
                Value.Properties["padding-left"]  = cssPaddingLeft.Value;

                Value.Properties["margin-right"] = cssMarginRight.Value;
                Value.Properties["margin-left"]  = cssMarginLeft.Value;

                Value.Properties["border-right-style"] = list.GetValueAny(cmbStyleRight.Text);
                Value.Properties["border-left-style"]  = list.GetValueAny(cmbStyleLeft.Text);

                Value.Properties["border-right-width"] = cssBorderWidthRight.Value;
                Value.Properties["border-left-width"]  = cssBorderWidthLeft.Value;

                Value.Properties["border-right-color"] = cssBorderColorRight.ColorText;
                Value.Properties["border-left-color"]  = cssBorderColorLeft.ColorText;
            }
            else
            {
                Value.Properties["padding-right"] = cssPaddingRight.Value;
                Value.Properties["padding-left"]  = cssPaddingLeft.Value;

                Value.Properties["margin-right"] = cssMarginRight.Value;
                Value.Properties["margin-left"]  = cssMarginLeft.Value;

                Value.Properties["border-right-style"] = list.GetValueAny(cmbStyleRight.Text);
                Value.Properties["border-left-style"]  = list.GetValueAny(cmbStyleLeft.Text);

                Value.Properties["border-right-width"] = cssBorderWidthRight.Value;
                Value.Properties["border-left-width"]  = cssBorderWidthLeft.Value;

                Value.Properties["border-right-color"] = cssBorderColorRight.ColorText;
                Value.Properties["border-left-color"]  = cssBorderColorLeft.ColorText;
            }
            if (HeightAuto)
            {
                //填充
                Value.Properties["padding-top"]    = cssPaddingUp.Value;
                Value.Properties["padding-bottom"] = cssPaddingDown.Value;
                //边界
                Value.Properties["margin-top"]    = cssMarginUp.Value;
                Value.Properties["margin-bottom"] = cssMarginDown.Value;
                //边框
                //***样式

                Value.Properties["border-top-style"]    = list.GetValueAny(cmbStyleUp.Text);
                Value.Properties["border-bottom-style"] = list.GetValueAny(cmbStyleDown.Text);
                //***宽度
                Value.Properties["border-top-width"]    = cssBorderWidthUp.Value;
                Value.Properties["border-bottom-width"] = cssBorderWidthDown.Value;
                //***颜色
                Value.Properties["border-top-color"]    = cssBorderColorUp.ColorText;
                Value.Properties["border-bottom-color"] = cssBorderColorDown.ColorText;
            }
            else
            {
                //填充
                Value.Properties["padding-top"]    = cssPaddingUp.Value;
                Value.Properties["padding-bottom"] = cssPaddingDown.Value;
                //边界
                Value.Properties["margin-top"]    = cssMarginUp.Value;
                Value.Properties["margin-bottom"] = cssMarginDown.Value;
                //边框
                //***样式

                Value.Properties["border-top-style"]    = list.GetValueAny(cmbStyleUp.Text);
                Value.Properties["border-bottom-style"] = list.GetValueAny(cmbStyleDown.Text);
                //***宽度
                Value.Properties["border-top-width"]    = cssBorderWidthUp.Value;
                Value.Properties["border-bottom-width"] = cssBorderWidthDown.Value;
                //***颜色
                Value.Properties["border-top-color"]    = cssBorderColorUp.ColorText;
                Value.Properties["border-bottom-color"] = cssBorderColorDown.ColorText;
            }

            #endregion

            #region check

            if (checkBoxPadding.Checked)
            {
                if (!cssPaddingUp.CheckValue())
                {
                    cssPaddingUp.SelectFirst();
                    return(false);
                }
            }
            else
            {
                foreach (Control control in tabPagePadding.Controls)
                {
                    if (control.GetType() == typeof(CssFieldUnit))
                    {
                        CssFieldUnit cfu = (CssFieldUnit)control;
                        if (!cfu.CheckValue())
                        {
                            cfu.SelectFirst();
                            return(false);
                        }
                    }
                }
            }
            if (checkBoxMargin.Checked)
            {
                if (!cssMarginUp.CheckValue())
                {
                    cssMarginUp.SelectFirst();
                    return(false);
                }
            }
            else
            {
                foreach (Control control in tabPageMargin.Controls)
                {
                    if (control.GetType() == typeof(CssFieldUnit))
                    {
                        CssFieldUnit cfu = (CssFieldUnit)control;
                        if (!cfu.CheckValue())
                        {
                            cfu.SelectFirst();
                            return(false);
                        }
                    }
                }
            }
            if (checkBoxBoderStyle.Checked)
            {
                list = CssResources.Resources["borderStyle"];
                if (!list.HasValue(cmbStyleUp.Text) && !string.IsNullOrEmpty(cmbStyleUp.Text))
                {
                    if (!CssUtility.ShowNotStandard(cmbStyleUp.Text))
                    {
                        cmbStyleUp.Focus();
                        return(false);
                    }
                }
            }
            else
            {
                foreach (Control control in groupStyle.Controls)
                {
                    if (control.GetType() == typeof(ComboBox))
                    {
                        ComboBox cfu = (ComboBox)control;
                        if (!list.HasValue(cfu.Text) && !string.IsNullOrEmpty(cfu.Text))
                        {
                            if (!CssUtility.ShowNotStandard(cfu.Text))
                            {
                                cfu.Focus();
                                return(false);
                            }
                        }
                    }
                }
            }

            if (checkBoxBorderWidth.Checked)
            {
                if (!cssBorderWidthUp.CheckValue())
                {
                    return(false);
                }
            }
            else
            {
                foreach (Control control in groupBoxWidth.Controls)
                {
                    if (control.GetType() == typeof(CssFieldUnit))
                    {
                        CssFieldUnit cfu = (CssFieldUnit)control;
                        if (!cfu.CheckValue())
                        {
                            cfu.SelectFirst();
                            return(false);
                        }
                    }
                }
            }

            return(base.LeaveValidate());

            #endregion
        }