コード例 #1
0
        /// <summary> 加载子项目
        /// </summary>
        private void LoadItems(DataTable dt)
        {
            string display = string.Empty;
            string value   = string.Empty;
            int    y       = 2;

            if (this.ItemHeight == 0)
            {
                this.ItemHeight = this.ctl.Height;
            }
            foreach (DataRow dr in dt.Rows)
            {
                if (dt.Columns.Contains(this.DisplayName))
                {
                    display = dr[this.DisplayName].ToString();
                }
                if (dt.Columns.Contains(this.ValueName))
                {
                    value = dr[this.ValueName].ToString();
                }
                UCCmbItem cmbItem = new UCCmbItem(display, value);
                cmbItem.CanDelete     = this.canDelete;
                cmbItem.SelectedColor = this.selectedColor;
                cmbItem.Width         = this.Width - 4;
                cmbItem.SetSize(ctl.Font, this.ItemHeight);
                cmbItem.ItemClicked += new UCCmbItem.ItemClickedHandler(this.After_Selected);
                if (this.canDelete)
                {
                    cmbItem.ItemDeleted += new UCCmbItem.ItemDeletedHandler(this.After_Deleted);
                }
                this.peContent.Controls.Add(cmbItem);
                cmbItem.Location = new Point(2, y);
                y += this.ItemHeight;

                display = string.Empty;
                value   = string.Empty;
            }
            this.Height = y + 2;
        }
コード例 #2
0
ファイル: FormCmb.cs プロジェクト: caocf/workspace-kepler
        /// <summary> 加载子项目 
        /// </summary>
        private void LoadItems(DataTable dt)
        {
            string display = string.Empty;
            string value = string.Empty;
            int y = 2;
            if (this.ItemHeight == 0)
            {
                this.ItemHeight = this.ctl.Height;
            }            
            foreach (DataRow dr in dt.Rows)
            {
                if (dt.Columns.Contains(this.DisplayName))
                {
                    display = dr[this.DisplayName].ToString();
                }
                if (dt.Columns.Contains(this.ValueName))
                {
                    value = dr[this.ValueName].ToString();
                }
                UCCmbItem cmbItem = new UCCmbItem(display, value);
                cmbItem.CanDelete = this.canDelete;
                cmbItem.SelectedColor = this.selectedColor;
                cmbItem.Width = this.Width - 4;
                cmbItem.SetSize(ctl.Font, this.ItemHeight);
                cmbItem.ItemClicked += new UCCmbItem.ItemClickedHandler(this.After_Selected);
                if (this.canDelete)
                {
                    cmbItem.ItemDeleted += new UCCmbItem.ItemDeletedHandler(this.After_Deleted);
                }
                this.peContent.Controls.Add(cmbItem);
                cmbItem.Location = new Point(2, y);
                y += this.ItemHeight;              

                display = string.Empty;
                value = string.Empty;
            }
            this.Height = y + 2;
        }