Exemple #1
0
        /// <summary> 加载子项目
        /// </summary>
        private void LoadItems(DataTable dt, bool canDelete)
        {
            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     = canDelete;
                cmbItem.SelectedColor = this.selectedColor;
                cmbItem.Width         = this.Width - 4;
                cmbItem.SetSize(ctl.Font, this.ItemHeight);
                cmbItem.ItemClicked += new UCCmbItem.ItemClickedHandler(After_Selected);
                this.peContent.Controls.Add(cmbItem);
                cmbItem.Location = new Point(2, y);
                y      += this.ItemHeight;
                display = string.Empty;
                value   = string.Empty;
            }
            this.Height = dt.Rows.Count * this.ItemHeight + 4;
        }
Exemple #2
0
 /// <summary> 加载子项目 
 /// </summary>
 private void LoadItems(DataTable dt, bool canDelete)
 {
     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 = canDelete;
         cmbItem.SelectedColor = this.selectedColor;
         cmbItem.Width = this.Width - 4;
         cmbItem.SetSize(ctl.Font, this.ItemHeight);
         cmbItem.ItemClicked += new UCCmbItem.ItemClickedHandler(After_Selected);
         this.peContent.Controls.Add(cmbItem);
         cmbItem.Location = new Point(2, y);
         y += this.ItemHeight;
         display = string.Empty;
         value = string.Empty;
     }
     this.Height = dt.Rows.Count * this.ItemHeight + 4;
 }