Esempio n. 1
0
        public static NGText GetText(PbBaseControlInfo pbCtl)
        {
            PbTextInfo pbText = (PbTextInfo)pbCtl;
            NGText     ngText = new NGText();

            //long color = pbText.TextColor;
            //int red, green, blue = 0;

            ngText.ID         = pbText.Id;
            ngText.Name       = pbText.Name;
            ngText.FieldLabel = pbText.LeftText;
            ngText.MustInput  = pbText.IsMustInput;
            ngText.XType      = pbText.TextArea == true ? "ngTextArea" : "ngText"; //根据设计器列属性设置判断是否文本域
            ngText.Visible    = pbText.Visible;
            ngText.MustInput  = pbText.IsMustInput;
            ngText.Protect    = pbText.IsProtect;
            ngText.MaxLength  = pbText.MaxLength;
            ngText.FieldStyle = GetRgb(pbText.TextColor);      //输入框字体颜色
            ngText.LabelStyle = GetRgb(pbText.LabelTextColor); //标签字体颜色
            ////将编辑页面的输入框颜色解析转变成前台代码
            //if (color > 0)
            //{
            //    blue = Convert.ToInt32(color / (256 * 256));
            //    green = Convert.ToInt32((color - blue * 256 * 256) / 256);
            //    red = Convert.ToInt32(color - green * 256 - blue * 256 * 256);
            //    ngText.FieldStyle = "color:rgb(" + red + "," + green + "," + blue + ");";
            //}
            //else {
            //    ngText.FieldStyle = "color:rgb(0,0,0);";
            //}

            return(ngText);
        }
Esempio n. 2
0
        public static ExtControlInfoBase GetControlInfo(string xtype, string name, string label, string fieldtype, int length, int declen)
        {
            ExtControlInfoBase control = null;

            switch (xtype)
            {
            case "ngText":
                NGText text = new NGText();
                text.maxLength = length;
                control        = text;
                break;

            case "ngTextArea":
                NGTextArea ctl = new NGTextArea();
                ctl.maxLength = length;
                control       = ctl;
                break;

            case "ngDate": control = new NGDate();
                break;

            case "ngDateTime": control = new NGDateTime();
                break;

            case "ngNumber": control = GetNumberCtl(fieldtype, length, declen, false);
                break;

            case "ngPercent":
                control = GetNumberCtl(fieldtype, length, declen, true);
                break;

            case "ngComboBox": control = new NGComboBox();
                break;

            case "ngCommonHelp": control = new NGCommonHelp();
                break;

            case "ngRichHelp":
                control = new NGRichHelp();
                break;

            case "ngRadio": control = new NGComboBox();
                break;

            case "ngCheckbox": control = new NGCheckbox();
                break;

            default: control = new NGText();
                break;
            }

            if (xtype == "ngPercent")
            {
                control.xtype = "ngNumber";
            }
            else
            {
                control.xtype = xtype;
            }
            control.name = name;
            if (name.IndexOf("*") > 0)
            {
                control.itemId = name.Split('*')[0];
            }
            else
            {
                control.itemId = name;
            }
            control.fieldLabel = label;

            return(control);
        }