Example #1
0
 protected void SelectAll(UcDataGridView grid, UcCheckBox chkBox, string colChkName, string idColName, string chkColName)
 {
     if (!_isMutiSelect)
     {
         this.ShowMessage("您当前是单选模式,不允许全部选择!");
         return;
     }
     for (int i = 0; i < grid.Rows.Count; i++)
     {
         grid.Rows[i].Cells[chkColName].Value = chkBox.Checked;
         SetCheck(grid, i, chkBox.Checked, idColName, chkColName);
     }
 }
Example #2
0
 protected void SelectAll(UcDataGridView grid, UcCheckBox chkAll, string idFieldName, string chkFieldName)
 {
     //if (!_isMutiSelect)
     //{
     //    this.ShowMessage("您当前是单选模式,不允许全部选择!");
     //    return;
     //}
     for (int i = 0; i < grid.Rows.Count; i++)
     {
         grid.Rows[i].Cells[chkFieldName].Value = chkAll.Checked;
         SetCheck(grid, i, chkAll.Checked, idFieldName, chkFieldName);
     }
 }
Example #3
0
        void CreateCheckBoxControl(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() : 110;
            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 : "";

            #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 创建控件
            UcCheckBox chk = new UcCheckBox();
            chk.Name             = engName;
            chk.Width            = w;
            chk.Height           = 22;
            chk.Text             = text;
            chk.AutoSize         = false;
            chk.CheckBoxStyle    = DevComponents.DotNetBar.eCheckBoxStyle.CheckBox;
            chk.Style            = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
            chk.Visible          = true;
            chk.TextVisible      = true;
            conInfo.InputControl = chk;
            conInfo.KeyName      = container.Name;
            if (!_dicControl.ContainsKey(engName))
            {
                _dicControl.Add(engName, conInfo);
            }
            #endregion
            #region 属性行为控制
            defaultValue = GetDefaultValue(defaultValue);
            if (defaultValue != null)
            {
                chk.Checked = defaultValue.ToLower() == "true" ? true : false;
            }
            #endregion
        }
Example #4
0
        protected void InitBaseSelectForm(bool isMutiSelect, UcDataGridView grid, UcCheckBox chkAll, string idColName, string chkColName)
        {
            _isMutiSelect = isMutiSelect;
            DataGridViewCheckBoxColumn chkSlc = new DataGridViewCheckBoxColumn()
            {
                ReadOnly   = false,
                Width      = 30,
                Frozen     = true,
                Name       = chkColName,
                HeaderText = ""
            };

            grid.Columns.Insert(0, chkSlc);
            #region 全选择功能控钮赋加事件
            if (chkAll != null && _isMutiSelect)
            {
                chkAll.Visible = true;
                int x = 0, y = 0;
                x = grid.Left + grid.Columns[chkColName].Width;
                y = grid.Top + 10;
                //chkAll.Location = new Point(x + 5, y);
                chkAll.BringToFront();
                chkAll.Visible = true;
                chkAll.Dock    = DockStyle.None;
                //chkAll.Size = new Size(15, 15);
                chkAll.CheckedChanged += delegate(object sender, EventArgs e)
                {
                    SelectAll(grid, chkAll, idColName, chkColName);
                };
            }
            else if (chkAll != null && !_isMutiSelect)
            {
                chkAll.Visible = false;
            }
            #endregion
            #region 表格赋加事件
            grid.CellContentClick += delegate(object sender, DataGridViewCellEventArgs e)
            {
                if (e.RowIndex < 0 || e.ColumnIndex < 0 || grid == null || grid.Columns[e.ColumnIndex].Name.IndexOf(chkColName) < 0)
                {
                    return;
                }
                bool isChk = grid[chkColName, e.RowIndex].EditedFormattedValue.ToBooleanHasNull();
                SetCheck(grid, e.RowIndex, isChk, idColName, chkColName);
            };
            #endregion
        }