当前位置: 首页>>代码示例>>C#>>正文


C# Forms.DataGridViewComboBoxCell类代码示例

本文整理汇总了C#中System.Windows.Forms.DataGridViewComboBoxCell的典型用法代码示例。如果您正苦于以下问题:C# DataGridViewComboBoxCell类的具体用法?C# DataGridViewComboBoxCell怎么用?C# DataGridViewComboBoxCell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DataGridViewComboBoxCell类属于System.Windows.Forms命名空间,在下文中一共展示了DataGridViewComboBoxCell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FilterPropertiesDlg_Load

        private void FilterPropertiesDlg_Load(object sender, EventArgs e)
        {
            // заполняем таблицу
            foreach (var item in filter.ColumnFilters.Values.ToList())
            {
                var row = new DataGridViewRow();

                row.Cells.Add(new DataGridViewTextBoxCell { Value = item.PropInfo.Name });
                row.Cells.Add(new DataGridViewTextBoxCell { Value = item.Title });

                if (item.EnabledValues.Length > 0)
                {
                    var valueCol = new DataGridViewComboBoxCell();
                    valueCol.Items.AddRange(item.EnabledValues.ToArray());
                    row.Cells.Add(valueCol);
                }
                else
                    row.Cells.Add(new DataGridViewTextBoxCell {Value = item.Value ?? string.Empty});

                var criteriasCol = new DataGridViewComboBoxCell();
                criteriasCol.Items.AddRange(item.GetStringCriterias());
                if (item.Criterias != ColumnFilterCriteria.Нет)
                    criteriasCol.Value = item.Criterias.ToString();
                else
                    criteriasCol.Value = criteriasCol.Items[0];
                row.Cells.Add(criteriasCol);
                grid.Rows.Add(row);
            }
        }
开发者ID:johnmensen,项目名称:TradeSharp,代码行数:29,代码来源:FilterPropertiesDlg.cs

示例2: InitGrid

 private void InitGrid(RedComboBox[] comboboxes, RedContext context)
 {
     foreach(RedComboBox cb in comboboxes)
     {
         var row = new DataGridViewRow();
         var c1 = new DataGridViewTextBoxCell();
         c1.Value = cb.Name;
         DataGridViewCell c2;
         if (cb.query.ToLowerInvariant() == "textedit")
         {
             c2 = new DataGridViewTextBoxCell();
             c2.Value = "";
         }
         else
         {
             c2 = new DataGridViewComboBoxCell();
             var t = cb.GetValues(context);
             foreach (DataRow r in t.Rows)
             {
                 (c2 as DataGridViewComboBoxCell).Items.Add(r[0].ToString());
             }
             (c2 as DataGridViewComboBoxCell).Value = (c2 as DataGridViewComboBoxCell).Items[0];
         }
         c2.ReadOnly = false;
         row.Cells.Add(c1);
         row.Cells.Add(c2);
         dataGridView1.Rows.Add(row);
     }
 }
开发者ID:rsemenov,项目名称:FizDb,代码行数:29,代码来源:ViewForm.cs

示例3: AddItems

 private void AddItems(string[] panels, int sections)
 {
     foreach (string panel in panels)
     {
         DataGridViewComboBoxCell reff = new DataGridViewComboBoxCell();
         DataGridViewTextBoxCell txt2A = new DataGridViewTextBoxCell();
         DataGridViewRow dataGridRow = new DataGridViewRow();
         //ComboBox reff = new ComboBox();
         reff.MaxDropDownItems = sections;
         //reff.DataSource =
         txt2A.Value = panel;
         for (int i = 1; i <= sections; i++)
             reff.Items.Add(i);
         try
         {
             dataGridRow.Cells.Add(txt2A);
             dataGridRow.Cells.Add(reff);
             Grid.Rows.Add(dataGridRow);
         }
         catch (Exception e)
         {
             MessageBox.Show(e.Message, "Error");
         }
     }
 }
开发者ID:GMTurbo,项目名称:Free-Form-Matcher,代码行数:25,代码来源:MessageDropDownBox.cs

示例4: CreateRow

        private DataGridViewRow CreateRow(Item item)
        {
            var row = new DataGridViewRow();

            row.Cells.Add(new DataGridViewTextBoxCell { Value = item.Name });
            row.Cells.Add(new DataGridViewButtonCell { Value = "Delete" });

            var isInShoppingList = RecipeBooks.Current.IsInShoppingList(item, excludeIfInRecipe: true);
            row.Cells.Add(new DataGridViewTextBoxCell
            {
                Value = isInShoppingList
                    ? RecipeBooks.Current.ShoppingList
                        .Where(sli => sli.Item.Id == item.Id && sli.Recipe == null)
                        .Sum(sli => sli.Quantity)
                    : 1
            });

            var unitCell = new DataGridViewComboBoxCell { DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing };
            unitCell.Items.AddRange(item.UnitType.Units().Select(u => u.GuiInfo().DisplayText).ToArray());
            unitCell.Value = item.DefaultBuyUnit.GuiInfo().DisplayText;
            row.Cells.Add(unitCell);

            row.Cells.Add(new DataGridViewButtonCell { Value = isInShoppingList ? REMOVE_FROM_LIST : ADD_TO_LIST });
            row.Cells.Add(new DataGridViewTextBoxCell { Value = item.Id });

            return row;
        }
开发者ID:madelson,项目名称:Recipe-Book,代码行数:27,代码来源:Tabs.cs

示例5: DataGridViewComboBoxColumn

		public DataGridViewComboBoxColumn ()
		{
			CellTemplate = new DataGridViewComboBoxCell();
			((DataGridViewComboBoxCell) CellTemplate).OwningColumnTemplate = this;
			SortMode = DataGridViewColumnSortMode.NotSortable;
			autoComplete = true;
			displayStyle = DataGridViewComboBoxDisplayStyle.DropDownButton;
			displayStyleForCurrentCellOnly = false;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:9,代码来源:DataGridViewComboBoxColumn.cs

示例6: SelectElement

		void SelectElement(DataGridViewComboBoxCell box, string itemName)
		{
			if (box.Items.IndexOf(itemName) == -1) {
				if (itemName == "Any CPU" && box.Items.IndexOf("AnyCPU") >= 0) {
					box.Value = "AnyCPU";
				} else {
					box.Value = box.Items[0];
				}
			} else {
				box.Value = itemName;
			}
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:12,代码来源:SolutionConfigurationEditor.cs

示例7: addRow

        public void addRow(DataGridView view, FileDirectory fd, string config)
        {
            DirectoryDataGridViewRow directoryDataGridViewRow = new DirectoryDataGridViewRow(fd);

            string text = DirectoryHandler.getInstance().getPathFromParent(fd, fd.getPath());
            DirectoryDataGridViewTextBoxCell directories = new DirectoryDataGridViewTextBoxCell(text);
            DataGridViewComboBoxCell commands = new DataGridViewComboBoxCell();
            DataGridViewCheckBoxCell include = new DataGridViewCheckBoxCell();
            DataGridViewCheckBoxCell echo = new DataGridViewCheckBoxCell();
            DataGridViewCheckBoxCell display = new DataGridViewCheckBoxCell();
            DataGridViewCheckBoxCell autoExit = new DataGridViewCheckBoxCell();
            DataGridViewCheckBoxCell waitForExit = new DataGridViewCheckBoxCell();
            if (text.Length > 50)
            {
                int i = text.Length;
                int num = 20;
                while (i > 50)
                {
                    i--;
                    num++;
                }
                text = text.Substring(0, 5) + "....." + text.Substring(num);
            }
            directories.Value = text;

            foreach(Command c in PreloadedConfigurationGetterService.getInstance().getCommandsFromXMLConfiguration(config)){
                commands.Items.Add(c.getName());
            }
            if(commands.Items.Count == 0) return;
            commands.Value = commands.Items[0];

            include.Value = true;
            echo.Value = true;
            display.Value = true;
            autoExit.Value = true;
            waitForExit.Value = true;
            directoryDataGridViewRow.Cells.Add(directories);
            directoryDataGridViewRow.Cells.Add(commands);
            directoryDataGridViewRow.Cells.Add(include);
            directoryDataGridViewRow.Cells.Add(display);
            directoryDataGridViewRow.Cells.Add(autoExit);
            directoryDataGridViewRow.Cells.Add(waitForExit);

            directories.ReadOnly = true;
            commands.ReadOnly = false;
            include.ReadOnly = false;
            echo.ReadOnly = false;
            display.ReadOnly = false;
            autoExit.ReadOnly = false;
            view.Rows.Add(directoryDataGridViewRow);
        }
开发者ID:Dekken,项目名称:buildatron,代码行数:51,代码来源:OperationalControlDataGridHandler.cs

示例8: BindComboBoxCellDataSource

        public static void BindComboBoxCellDataSource(DataGridViewComboBoxCell cell, string[][] dataSource)
        {
            if (dataSource == null ||
                dataSource.Length.Equals(0))
            {
                cell.DataSource = null;
                return;
            }
            List<DataSourceNode> dataSourceNodeList = BindArrayDataHelper.GetDataSource(dataSource, 0, 1);

            cell.DataSource = dataSourceNodeList;
            cell.DisplayMember = "Text";
            cell.ValueMember = "Value";
        }
开发者ID:daywrite,项目名称:EApp,代码行数:14,代码来源:DataGridViewHelper.cs

示例9: AddGenerationParameterAsComboBox

 private void AddGenerationParameterAsComboBox(String g, String v, Type t)
 {
     DataGridViewRow r = new DataGridViewRow();
     DataGridViewCell rColumn1 = new DataGridViewTextBoxCell();
     DataGridViewComboBoxCell rColumn2 = new DataGridViewComboBoxCell();
     rColumn2.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
     rColumn1.Value = g;
     rColumn2.Items.Clear();
     string[] mt = Enum.GetNames(t);
     rColumn2.Items.AddRange(mt);
     rColumn2.Value = v;
     r.Cells.Add(rColumn1);
     r.Cells.Add(rColumn2);
     generationParametersTable.Rows.Add(r);
 }
开发者ID:aramazhari,项目名称:complexnetwork,代码行数:15,代码来源:MainWindow.cs

示例10: FreshDG

        private void FreshDG()
        {
            DataSet datasetAlg = new DataSet();

            DG_Forecast.Rows.Clear();
            dataset.Clear();
            dataset = ServiceContainer.GetService<IGasDAL>().QueryData("EquipName", "EquipTypeSlet");
            int j = 0;
            foreach (DataRow dr in dataset.Tables[0].Rows)
            {

                DataGridViewRow row = new DataGridViewRow();
                DataGridViewTextBoxCell txtboxcell0 = new DataGridViewTextBoxCell();
                txtboxcell0.Value = dataset.Tables[0].Rows[j]["EquipName"];
                row.Cells.Add(txtboxcell0);

                DataGridViewComboBoxCell comboxcell = new DataGridViewComboBoxCell();
                datasetAlg = ServiceContainer.GetService<IGasDAL>().QueryData("EquipAlgSlet", "EquipName", dataset.Tables[0].Rows[j]["EquipName"].ToString());
                int i = 0;
                foreach (DataRow dr2 in datasetAlg.Tables[0].Rows)
                {

                    comboxcell.Items.Add(datasetAlg.Tables[0].Rows[i]["AlgName"]);

                    i++;
                }
                row.Cells.Add(comboxcell);
                //comboxcell.DisplayMember=;

                DataGridViewComboBoxCell comboxcel2 = new DataGridViewComboBoxCell();
                comboxcel2.Items.Add("5");
                comboxcel2.Items.Add("10");
                row.Cells.Add(comboxcel2);
                comboxcel2.Value = "10";

                DataGridViewComboBoxCell comboxcel3 = new DataGridViewComboBoxCell();
                comboxcel3.Items.Add("15");
                comboxcel3.Items.Add("30");
                comboxcel3.Items.Add("60");
                row.Cells.Add(comboxcel3);
                comboxcel3.Value = "30";

                DG_Forecast.Rows.Add(row);

                j++;
            }
        }
开发者ID:s20141478,项目名称:WG_GasManage,代码行数:47,代码来源:ForecastConfig.cs

示例11: CreaColumna

 public void CreaColumna(string NameColumna,string HeaderColumna)
 {
     DataGridViewComboBoxColumn column = new DataGridViewComboBoxColumn();
     column.Name = NameColumna;
     column.HeaderText = HeaderColumna;
     //DataGridViewCell cell = new DataGridViewTextBoxCell();
     DataGridViewCell cell = new DataGridViewComboBoxCell();
     cell.Style.BackColor = Color.White;
     column.CellTemplate = cell;
     column.FlatStyle = FlatStyle.Popup;
     dataGridView1.Columns.Add(column);
     if (NameColumna == "NewPuesto")
         cargaPuestos(column);
     else if (NameColumna == "Rancho")
         cargaRancho(column);
     else
         column.Items.AddRange("P", "E", "J", "EX");
 }
开发者ID:xcytek,项目名称:vinedoscsharp,代码行数:18,代码来源:EmpleadoArchivo.cs

示例12: UpdateDisplay

        private void UpdateDisplay()
        {
            IVIHandler.Reset();
            IviHandler = IVIHandler.Instance;
            IviHandler.IviConfigStore.Deserialize(IviHandler.IviConfigStore.MasterLocation);

            AdapterConfigList.Rows.Clear();
            foreach (IIviSoftwareModule2 SoftwareModule in IviHandler.IviConfigStore.SoftwareModules)
            {
                if (!SoftwareModule.Name.StartsWith("nis"))
                {
                    DataGridViewRow Row = new DataGridViewRow();
                    DataGridViewCheckBoxCell UpdateCheckBox = new DataGridViewCheckBoxCell();
                    DataGridViewTextBoxCell SoftwareModuleTextBox = new DataGridViewTextBoxCell();
                    DataGridViewTextBoxCell CurrentAdapterClassTextBox = new DataGridViewTextBoxCell();
                    DataGridViewComboBoxCell NewAdapterClassComboBox = new DataGridViewComboBoxCell();

                    UpdateCheckBox.Value = false;
                    SoftwareModuleTextBox.Value = SoftwareModule.Name;
                    string className = SoftwareModule.AssemblyQualifiedClassName;

                    if (!className.Equals(string.Empty))
                    {
                        Type type = Type.GetType(SoftwareModule.AssemblyQualifiedClassName);
                        if (type != null)
                        {
                            CurrentAdapterClassTextBox.Value = type.Name;
                        }
                    }

                    NewAdapterClassComboBox.Items.Add(string.Empty);
                    NewAdapterClassComboBox.Items.AddRange(IviCAdapterList);
                    NewAdapterClassComboBox.Value = NewAdapterClassComboBox.Items[0];

                    Row.Cells.Add(UpdateCheckBox);
                    Row.Cells.Add(SoftwareModuleTextBox);
                    Row.Cells.Add(CurrentAdapterClassTextBox);
                    Row.Cells.Add(NewAdapterClassComboBox);

                    AdapterConfigList.Rows.Add(Row);
                }
            }
        }
开发者ID:MaMic,项目名称:IVI.C.NET.Adapter,代码行数:43,代码来源:Utility.cs

示例13: setData

        public void setData(oFunction functionBase, oSingleData measuredData)
        {
            this.functionBase = functionBase;
            this.measuredData = measuredData;
            if (functionBase == null)
            {
                this.Rows.Clear();
                return;
            }
            this.argumentClasses = functionBase.getArgumentList();

            // Cleanup this datagridview)
            this.Rows.Clear();

            // Build the combobox selection options
            string[] options = Enum.GetNames(typeof(DISPLAY_TYPE));

            // Fill out this datagridview based on the supplied data
            ARGUMENT_STRING_COLLECTION stringData = functionBase.getArgumentString(measuredData);
            DataGridViewRow[] newRows = new DataGridViewRow[argumentClasses.Count];
            for( int i = 0; i < argumentClasses.Count; i++ )
            {
                // Add this row
                newRows[i] = new DataGridViewRow();

                // Add the name cell
                newRows[i].Cells[newRows[i].Cells.Add(new DataGridViewTextBoxCell())].Value = stringData.names[i];

                // Add the type cell combobox
                DataGridViewComboBoxCell comboBox = new DataGridViewComboBoxCell();
                comboBox.DisplayStyle = DataGridViewComboBoxDisplayStyle.ComboBox;
                comboBox.Value = Enum.GetName(typeof(DISPLAY_TYPE), argumentClasses[i].displayMethod);
                comboBox.Items.AddRange(options);
                newRows[i].Cells.Add(comboBox);

                // Add the value cell
                newRows[i].Cells[newRows[i].Cells.Add(new DataGridViewTextBoxCell())].Value = stringData.values[i];
            }

            // Add the new rows
            this.Rows.AddRange(newRows);
        }
开发者ID:obarhleam,项目名称:FunctionHacker,代码行数:42,代码来源:DataGridViewCall.cs

示例14: RowEditorDlg

        public RowEditorDlg(MetaDataRow mdrow)
        {
            this.mdrow = mdrow;
            InitializeComponent();

            for (int i = 0; i < mdrow.Parts.Length; i++)
            {
                DataGridViewRow row = new DataGridViewRow();
                row.Cells.Add(new DataGridViewTextBoxCell() { Value = i.ToString() });
                row.Cells.Add(new DataGridViewTextBoxCell() { Value = (Convert.ToUInt64(mdrow.Parts[i])).ToString("X" +(Marshal.SizeOf(mdrow.Parts[i]))*2)  });
                DataGridViewComboBoxCell cbox = new DataGridViewComboBoxCell();
                cbox.Items.Add("Byte");
                cbox.Items.Add("UInt16");
                cbox.Items.Add("UInt32");
                cbox.Items.Add("UInt64");
                cbox.Value = mdrow.Parts[i].GetType().Name;
                row.Cells.Add(cbox);
                dataGridView1.Rows.Add(row);
            }
        }
开发者ID:Chemiculs,项目名称:AsmResolver,代码行数:20,代码来源:RowEditorDlg.cs

示例15: ParameterInputForm

        public ParameterInputForm(
			IEnumerable<string[]> required,
			IEnumerable<string[]> optional
		)
            : this()
        {
            foreach (string[] a in required) grdParameters.Rows.Add(a[0], a[1]);
            foreach (string[] a in optional)
            {
                string[] options = a[2].Split('|');
                grdParameters.Rows.Add(a[0], a[1], a[2]);
                if (options.Length > 1)
                {
                    var cbb = new DataGridViewComboBoxCell();
                    foreach (string o in options) cbb.Items.Add(o);
                    string s = a[1] ?? "";
                    if (cbb.Items.Contains(s)) cbb.Value = s;
                    grdParameters[1, grdParameters.Rows.Count-1] = cbb;
                }
            }
        }
开发者ID:ashish-antil,项目名称:Products,代码行数:21,代码来源:ParameterInputForm.cs


注:本文中的System.Windows.Forms.DataGridViewComboBoxCell类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。