コード例 #1
0
ファイル: SearchAssembleHandler.cs プロジェクト: windygu/CRM
        void CreateRadioBoxControl(XmlNode node, Control container)
        {
            string  engName      = node.Attributes["Name"] != null ? node.Attributes["Name"].Value : "";
            string  chsName      = node.Attributes["CHName"] != null ? node.Attributes["CHName"].Value : "";
            string  dataType     = node.Attributes["DataType"] != null ? node.Attributes["DataType"].Value : "";
            bool    isMuti       = node.Attributes["IsMuti"] != null ? node.Attributes["IsMuti"].Value.ToBooleanHasNull() : false;
            string  idConName    = node.Attributes["IDConName"] != null ? node.Attributes["IDConName"].Value : "";
            int     w            = node.Attributes["Width"] != null ? node.Attributes["Width"].Value.ToInt32() : 60;
            int     h            = node.Attributes["Height"] != null ? node.Attributes["Height"].Value.ToInt32() : 20;
            string  defaultValue = node.Attributes["DefaultValue"] != null ? node.Attributes["DefaultValue"].Value : "";
            string  codeValue    = node.Attributes["CodeValue"] != null ? node.Attributes["CodeValue"].Value : "";
            string  text         = node.Attributes["Text"] != null ? node.Attributes["Text"].Value : "";
            string  groupName    = node.Attributes["GroupName"] != null ? node.Attributes["GroupName"].Value : "";
            int     slcIdx       = node.Attributes["SelectIndex"] != null ? node.Attributes["SelectIndex"].Value.ToInt32() : 0;
            Control panel;

            if (_dicRadioGroup.ContainsKey(groupName))
            {
                panel = _dicRadioGroup[groupName];
            }
            else
            {
                panel = new UcPanel(); panel.Width = 1;
            }
            #region 标题
            ControlInfo conInfo = new ControlInfo(_form);
            if (chsName != "")
            {
                UcLabelX label = new UcLabelX();
                label.Name           = "lbl" + engName;
                label.Text           = chsName;
                label.AutoSize       = true;
                conInfo.LabelControl = label;
            }
            #endregion
            #region 创建控件
            string[]   arrText = text.ToStringHasNull().Split(';');
            string[]   arrTextEx;
            UcRadioBox chk; int idx = 0;
            foreach (string s in arrText)
            {
                arrTextEx = s.Split(',');
                chk       = new UcRadioBox();
                chk.Name  = engName;
                chk.Width = w;
                chk.Text  = arrTextEx.Length > 1 ? arrTextEx[1] : "";
                chk.Tag   = arrTextEx.Length > 0 ? arrTextEx[0] : "";
                chk.Dock  = DockStyle.Left;
                if (slcIdx == idx)
                {
                    chk.Checked = true;
                }
                panel.Width += chk.Width;
                panel.Height = 22;
                panel.Controls.Add(chk);
                idx++;
            }
            conInfo.InputControl = panel;
            conInfo.KeyName      = container.Name;
            if (!_dicControl.ContainsKey(engName))
            {
                _dicControl.Add(engName, conInfo);
            }
            #endregion
        }
コード例 #2
0
ファイル: SearchAssembleHandler.cs プロジェクト: windygu/CRM
        void CreateDropDownList(XmlNode node, Control container)
        {
            string engName      = node.Attributes["Name"] != null ? node.Attributes["Name"].Value : "";
            string chsName      = node.Attributes["CHName"] != null ? node.Attributes["CHName"].Value : "";
            string dataType     = node.Attributes["DataType"] != null ? node.Attributes["DataType"].Value : "";
            bool   isMuti       = node.Attributes["IsMuti"] != null ? node.Attributes["IsMuti"].Value.ToBooleanHasNull() : false;
            string idConName    = node.Attributes["IDConName"] != null ? node.Attributes["IDConName"].Value : "";
            int    w            = node.Attributes["Width"] != null ? node.Attributes["Width"].Value.ToInt32() : 80;
            int    h            = node.Attributes["Height"] != null ? node.Attributes["Height"].Value.ToInt32() : 28;
            string defaultValue = node.Attributes["DefaultValue"] != null ? node.Attributes["DefaultValue"].Value : "";
            string codeValue    = node.Attributes["CodeValue"] != null ? node.Attributes["CodeValue"].Value : "";
            //ListValue  For ComboBox
            string ListValue = node.Attributes["ListValue"] != null ? node.Attributes["ListValue"].Value : "";

            #region 标题
            ControlInfo conInfo = new ControlInfo(_form);
            if (chsName != "")
            {
                UcLabelX label = new UcLabelX();
                label.Name           = "lbl" + engName;
                label.Text           = chsName;
                label.AutoSize       = true;
                conInfo.LabelControl = label;
            }
            #endregion
            #region 创建文本控件
            UcComboBox cmb = new UcComboBox();
            cmb.Name             = engName;
            cmb.Width            = w;
            cmb.Style            = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
            cmb.DrawMode         = DrawMode.OwnerDrawFixed;
            conInfo.InputControl = cmb;
            conInfo.KeyName      = container.Name;
            if (!_dicControl.ContainsKey(engName))
            {
                _dicControl.Add(engName, conInfo);
            }

            #endregion
            #region 属性行为控制
            if (!string.IsNullOrEmpty(ListValue))//绑定用户枚举列表
            {
                List <SYS_DictItemLineResult> lstSR = new List <SYS_DictItemLineResult>();
                string[] arr1 = new string[] { };
                string[] arr2 = new string[] { };
                arr1 = ListValue.Split(';');
                foreach (string s in arr1)
                {
                    arr2 = s.Split(',');
                    if (arr2.Length < 1)
                    {
                        continue;
                    }
                    lstSR.Add(new SYS_DictItemLineResult()
                    {
                        ItemValue = arr2[0], ItemValue2 = arr2[1]
                    });
                }
                cmb.DisplayMember = "ItemValue2";
                cmb.ValueMember   = "ItemValue";
                cmb.DataSource    = lstSR;
                cmb.SelectedIndex = -1;
            }
            else if (string.IsNullOrEmpty(codeValue))//绑定字典表数据
            {
                _dictLineLogic.BindComboBox(cmb, codeValue, _dictItemList);
            }
            defaultValue = GetDefaultValue(defaultValue);
            if (defaultValue != null)
            {
                if (string.IsNullOrEmpty(codeValue))
                {
                    SYS_DictItemLineLogic.SetCombolSelectedIndex(cmb, defaultValue, true);
                }
                else
                {
                    cmb.SelectedValue = defaultValue;
                }
            }
            #endregion
        }