Наследование: DropDownColumn
Пример #1
0
	   public void InitializeTable(string[] patterns, string[] categories) {
		  this._templateTable.ColumnModel = new ColumnModel();
		  this._templateTable.TableModel = new TableModel();
		  // 0: Name
		  ComboBoxColumn patternCol = new ComboBoxColumn("Pattern");
		  ComboBoxCellEditor patternEditor = new ComboBoxCellEditor();
		  patternEditor.TextChanged += new EventHandler(patternEditor_TextChanged);
		  patternEditor.DropDownStyle = DropDownStyle.DropDown;
//		  patternEditor.Items.AddRange(patterns);
		  patternEditor.AutCompleteAddItems(patterns, AutoCompleteMode.Suggest);
		  patternCol.Editor = patternEditor;
		  patternCol.Editable = true;
		  this._templateTable.ColumnModel.Columns.Add(patternCol);
		  // 1: Type
		  ComboBoxColumn typeCol = new ComboBoxColumn("Type");
		  ComboBoxCellEditor typeEditor = new ComboBoxCellEditor();
		  typeEditor.Items.Add(CategoryItemType.String.ToString());
		  typeEditor.Items.Add(CategoryItemType.WildCard.ToString());
		  typeEditor.Items.Add(CategoryItemType.Regex.ToString());
		  typeCol.Editor = typeEditor;
		  typeCol.Editable = true;
		  this._templateTable.ColumnModel.Columns.Add(typeCol);
		  // 2: Category
		  ComboBoxColumn categoryCol = new ComboBoxColumn("Category");
		  ComboBoxCellEditor categoryEditor = new ComboBoxCellEditor();
		  categoryEditor.DropDownStyle = DropDownStyle.DropDown;
//		  categoryEditor.Items.AddRange(categories);
		  categoryEditor.AutCompleteAddItems(categories, AutoCompleteMode.SuggestAppend);
		  categoryCol.Editor = categoryEditor;
		  categoryCol.Editable = true;
		  this._templateTable.ColumnModel.Columns.Add(categoryCol);

		  AdjustColumnWidth();

		  this._templateTable.BeginEditing += new XPTable.Events.CellEditEventHandler(_templateTable_BeginEditing);
		  this._templateTable.AfterEditing += new XPTable.Events.CellEditEventHandler(_templateTable_AfterEditing);
		  this._templateTable.MouseDown += new System.Windows.Forms.MouseEventHandler(this._templateTable_MouseDown);
		  this._templateTable.AlternatingRowColor = Color.LightBlue;
	   }
Пример #2
0
            public override Column GetColumn(PropertyDescriptor prop, int index)
            {
                if (prop.Name == "size")
                {
                    ImageColumn col = new ImageColumn("size", _list.Images[0], 100);
                    return col;
                }
                else if (prop.Name == "like them?")
                {
                    CheckBoxColumn c = (CheckBoxColumn)base.GetColumn(prop, index);
                    c.Alignment = ColumnAlignment.Center;
                    c.DrawText = false;
                    c.CheckSize = new Size(25, 25);
                    return c;
                }
                else if (prop.Name == "name")
                {
                    ComboBoxColumn combo = new ComboBoxColumn("name");

                    return combo;
                }
                else
                {
                    return base.GetColumn(prop, index);
                }
            }