• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Forms.DataGridViewComboBoxCell类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Setup

        public void Setup(string FirstHeader, IEnumerable<object> FirstList, string SecondHeader, IEnumerable<object> SecondList, DataTable sourceData)
        {
            this.InitializeComponent();
            this.FirstList = FirstList;
            this.SecondList = SecondList;

            this.AllowUserToAddRows = false;
            this.AllowUserToDeleteRows = false;

            this.Columns.Clear();
            var col1 = new DataGridViewTextBoxColumn();
            col1.ReadOnly = true;
            this.Columns.Add(col1);

            var data = sourceData != null
                    ? sourceData
                    : (from x in FirstList
                       from y in new object[] { null }
                       select new { x, y }).ToDataTable("Data");

            var secondCol = new DataGridViewComboBoxColumn();
            var secondTemplate = new DataGridViewComboBoxCell();
            secondTemplate.DataSource = SecondList.Select(i => new { i }).ToDataTable("Combo Items");
            secondTemplate.DisplayMember = "i";
            secondCol.CellTemplate = secondTemplate;

            this.Columns.Add(secondCol);

            this.Columns[0].Width = (int)(this.Width * 0.40);
            this.Columns[1].Width = (int)(this.Width * 0.40);
            this.Columns[0].HeaderText = FirstHeader;
            this.Columns[1].HeaderText = SecondHeader;
            this.Columns[0].DataPropertyName = "x";
            this.Columns[1].DataPropertyName = "y";

            this.DataSource = data;
            this.Data = data;

            // this.DataError += new DataGridViewDataErrorEventHandler(AssociationGridView_DataError);
        }
开发者ID:vimalgupta1980,项目名称:dotnetlibs,代码行数:40,代码来源:AssociationGridView.cs


示例17: AddProperty

        /// <summary>
        /// Add the property to PropertyWindow.
        /// </summary>
        /// <param name="d">EcellData of property.</param>
        /// <param name="type">Type of property.</param>
        /// <returns>Row in DataGridView.</returns>
        DataGridViewRow AddProperty(EcellData d, string type)
        {
            DataGridViewRow row = new DataGridViewRow();
            DataGridViewTextBoxCell propNameCell = new DataGridViewTextBoxCell();
            DataGridViewCell propValueCell;
            propNameCell.Value = d.Name;
            row.Cells.Add(propNameCell);
            if (m_propDic == null || m_current.Type != Constants.xpathProcess
                || m_propDic.ContainsKey(d.Name))
            {
                propNameCell.Style.BackColor = Color.LightGray;
                propNameCell.Style.SelectionBackColor = Color.LightGray;
                propNameCell.ReadOnly = true;
            }
            else
            {
                propNameCell.ReadOnly = false;
                propNameCell.Style.BackColor = SystemColors.Window;
                propNameCell.Style.ForeColor = SystemColors.WindowText;
                propNameCell.Style.SelectionBackColor = SystemColors.Highlight;
                propNameCell.Style.SelectionForeColor = SystemColors.HighlightText;
            }

            if (d.Value == null) return null;

            if (d.Name == Constants.xpathExpression)
            {
                propValueCell = new DataGridViewOutOfPlaceEditableCell();
                propValueCell.Value = (string)d.Value;
                ((DataGridViewOutOfPlaceEditableCell)propValueCell).OnOutOfPlaceEditRequested =
                    delegate(DataGridViewOutOfPlaceEditableCell c)
                    {
                        string retval = ShowFormulatorDialog(c.Value == null ? "" : c.Value.ToString());
                        if (retval != null)
                        {
                            propValueCell.Value = retval;
                            UpdateExpression(retval);
                            return true;
                        }
                        return false;
                    };
            }
            else if (d.Name == Constants.xpathVRL)
            {
                propValueCell = new DataGridViewLinkCell();
                propValueCell.Value = MessageResources.LabelEdit;
            }
            else if (d.Name == Constants.xpathStepperID)
            {
                propValueCell = new DataGridViewComboBoxCell();
                bool isexist = false;
                string stepperName = d.Value.ToString();
                foreach (EcellObject obj in m_env.DataManager.GetStepper(m_current.ModelID))
                {
                    if (!string.IsNullOrEmpty(stepperName) &&
                        stepperName.Equals(obj.Key))
                    {
                        isexist = true;
                    }
                    ((DataGridViewComboBoxCell)propValueCell).Items.Add(obj.Key);
                }
                if (isexist)
                    propValueCell.Value = d.Value.ToString();
                m_stepperIDComboBox = (DataGridViewComboBoxCell)propValueCell;
            }
            else
            {
                propValueCell = new DataGridViewTextBoxCell();
                if (d.Value.IsDouble)
                {
                    propValueCell.Value = ((double)d.Value).ToString(m_env.DataManager.DisplayStringFormat);
                }
                else
                {
                    propValueCell.Value = (string)d.Value;
                }
            }
            row.Cells.Add(propValueCell);
            m_dgv.Rows.Add(row);

            if (d.Settable && !d.Name.Equals(Constants.xpathVRL))
            {
                propValueCell.ReadOnly = false;
            }
            else
            {
                propValueCell.ReadOnly = true;
                propValueCell.Style.ForeColor = SystemColors.GrayText;
            }
            propValueCell.Tag = d;

            return row;
        }
开发者ID:ecell,项目名称:ecell3-ide,代码行数:99,代码来源:PropertyWindow.cs


示例18: AddNonDataProperty

        /// <summary>
        /// Add the non data property to DataGridView.
        /// </summary>
        /// <param name="propName">the property name.</param>
        /// <param name="propValue">the property value.</param>
        /// <param name="readOnly">the flag whether this property is readonly.</param>
        /// <returns>Added DataGridViewRow.</returns>
        DataGridViewRow AddNonDataProperty(string propName, string propValue, bool readOnly)
        {
            DataGridViewRow row = new DataGridViewRow();
            DataGridViewTextBoxCell propNameCell = new DataGridViewTextBoxCell();
            DataGridViewCell propValueCell = null;
            row.Cells.Add(propNameCell);
            propNameCell.Style.BackColor = Color.LightGray;
            propNameCell.Style.SelectionBackColor = Color.LightGray;
            propNameCell.ReadOnly = true;
            propNameCell.Value = propName;

            if (propName == Constants.xpathClassName)
            {
                if (m_current.Type == Constants.xpathSystem || m_current.Type == Constants.xpathVariable)
                {
                    propValueCell = new DataGridViewComboBoxCell();
                    ((DataGridViewComboBoxCell)propValueCell).Items.Add(propValue);
                    propValueCell.Value = propValue;
                }
                else if (m_current.Type == Constants.xpathText)
                {
                    propValueCell = new DataGridViewTextBoxCell();
                    propValueCell.Value = "Text";
                    readOnly = true; // forcefully marked as readonly
                }
                else if (m_current.Type == Constants.xpathStepper)
                {
                    propValueCell = new DataGridViewComboBoxCell();
                    bool isHit = false;
                    List<string> stepList = m_env.DMDescriptorKeeper.StepperDmList;
                    foreach (string sName in stepList)
                    {
                        ((DataGridViewComboBoxCell)propValueCell).Items.Add(sName);
                        if (sName == propValue)
                            isHit = true;
                    }

                    if (!isHit)
                    {
                        ((DataGridViewComboBoxCell)propValueCell).Items.Add(propValue);
                    }
                    propValueCell.Value = propValue;
                    DMDescriptor desc = m_env.DMDescriptorKeeper.GetDMDescriptor(Constants.xpathStepper, propValue);
                    if (desc != null)
                        propValueCell.ToolTipText = desc.Description;
                    else
                        propValueCell.ToolTipText = "";

                }
                else
                {
                    propValueCell = new DataGridViewComboBoxCell();
                    bool isHit = false;
                    List<string> procList = m_env.DMDescriptorKeeper.ProcessDmList;
                    foreach (string pName in procList)
                    {
                        ((DataGridViewComboBoxCell)propValueCell).Items.Add(pName);
                        if (pName == propValue)
                            isHit = true;
                    }

                    if (!isHit)
                    {
                        ((DataGridViewComboBoxCell)propValueCell).Items.Add(propValue);
                    }
                    propValueCell.Value = propValue;
                    DMDescriptor desc = m_env.DMDescriptorKeeper.GetDMDescriptor(Constants.xpathProcess, propValue);
                    if (desc != null)
                        propValueCell.ToolTipText = desc.Description;
                    else
                        propValueCell.ToolTipText = "";
                }
            }
            else
            {
                propValueCell = new DataGridViewTextBoxCell();
                propValueCell.Value = propValue;
            }
            row.Cells.Add(propValueCell);
            propValueCell.Tag = propName;
            propValueCell.ReadOnly = readOnly;
            if (readOnly)
                propValueCell.Style.ForeColor = SystemColors.GrayText;

            m_dgv.Rows.Add(row);
            m_nonDataProps.Add(propName);
            return row;
        }
开发者ID:ecell,项目名称:ecell3-ide,代码行数:95,代码来源:PropertyWindow.cs


示例19: CarregaGridViewParametros

        private void CarregaGridViewParametros()
        {
            dgParametros.Rows.Clear();
            foreach (var param in _parametros)
            {
                var row = new DataGridViewRow();

                var nome = new DataGridViewTextBoxCell { Value = param.ParameterName };
                var valor = new DataGridViewMaskedTextCell { Value = param.ParameterValue };
                var defineNull = new DataGridViewCheckBoxCell { Value = param.DefineNull };
                var lista = new DataGridViewComboBoxCell { DataSource = _tiposDadosParametros, DisplayMember = "Key", ValueMember = "Value", Value = "System.Object|" };
                row.Cells.Add(nome);
                row.Cells.Add(defineNull);
                row.Cells.Add(lista);
                row.Cells.Add(valor);

                dgParametros.Rows.Add(row);
            }
        }
开发者ID:RodrigoDotNet,项目名称:gerador-de-camadas,代码行数:19,代码来源:frmPesquisaManual.cs


示例20: prepareGrid4Feature


//.........这里部分代码省略.........
            {
                DataGridViewRow currentRow = new DataGridViewRow();

                // the feature itself is the main osm key value pair
                string[] osmkeyvalue = null;

                try
                {
                    osmkeyvalue = currentFeatureType.name.Split("=".ToCharArray());
                }
                catch { }


                if (osmkeyvalue != null && osmkeyvalue.Length > 1)
                {
                    // name of the tag - tag type
                    DataGridViewCell currentTagCell = new DataGridViewTextBoxCell();
                    currentTagCell.Value = osmkeyvalue[0];

                    // for localization include the translated language into a tooltip
                    if (m_editTags.ContainsKey(osmkeyvalue[0]))
                    {
                        if (!String.IsNullOrEmpty(m_editTags[osmkeyvalue[0]].displayname))
                        {
                            currentTagCell.ToolTipText = m_editTags[osmkeyvalue[0]].displayname;
                        }
                    }

                    currentRow.Cells.Insert(0, currentTagCell);
                    currentRow.Cells[0].ReadOnly = true;

                    // value of the tag
                    DataGridViewCell currentValueCell = null;
                    currentValueCell = new DataGridViewComboBoxCell();
                    foreach (var domainvalue in m_domainDictionary[osmkeyvalue[0]].domainvalue)
                    {
                        if (IsGeometryTypeEqual(currentFeature.Shape.GeometryType, domainvalue.geometrytype))
                        {
                            ((DataGridViewComboBoxCell)currentValueCell).Items.Add(domainvalue.value);
                        }
                    }
                    currentValueCell.Value = osmkeyvalue[1];

                    // for localization include the translated language into a tooltip
                    if (m_editTags.ContainsKey(osmkeyvalue[0]))
                    {
                        ESRI.ArcGIS.OSM.OSMClassExtension.tagvalue[] possibleValues = m_editTags[osmkeyvalue[0]].tagvalue;

                        if (possibleValues != null)
                        {
                            for (int valueIndex = 0; valueIndex < possibleValues.Length; valueIndex++)
                            {
                                if (osmkeyvalue[1].Equals(possibleValues[valueIndex].name) == true)
                                {
                                    if (!String.IsNullOrEmpty(possibleValues[valueIndex].displayname))
                                    {
                                        currentValueCell.ToolTipText = possibleValues[valueIndex].displayname;
                                    }
                                }
                            }
                        }
                    }

                    currentRow.Cells.Insert(1, currentValueCell);
                    currentRow.Cells[1].ReadOnly = false;
开发者ID:leijiancd,项目名称:arcgis-osm-editor,代码行数:66,代码来源:OSMFeatureInspector.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Forms.DataGridViewComboBoxColumn类代码示例发布时间:2022-05-26
下一篇:
C# Forms.DataGridViewColumnEventArgs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap