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

C# Forms.DataGridViewCheckBoxCell类代码示例

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

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



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

示例1: Defaults

		public void Defaults ()
		{
			DataGridViewCheckBoxCell cell = new DataGridViewCheckBoxCell ();

			Assert.AreEqual (null, cell.EditedFormattedValue, "A1");
			Assert.AreEqual (false, cell.EditingCellValueChanged, "A2");
			Assert.AreEqual (null, cell.EditType, "A3");
			Assert.AreEqual (null, cell.FalseValue, "A4");
			Assert.AreEqual (typeof (bool), cell.FormattedValueType, "A5");
			Assert.AreEqual (null, cell.IndeterminateValue, "A6");
			Assert.AreEqual (false, cell.ThreeState, "A7");
			Assert.AreEqual (null, cell.TrueValue, "A8");
			Assert.AreEqual (typeof (bool), cell.ValueType, "A9");

			Assert.AreEqual ("DataGridViewCheckBoxCell { ColumnIndex=-1, RowIndex=-1 }", cell.ToString (), "A10");
			
			cell.ThreeState = true;

			Assert.AreEqual (null, cell.EditedFormattedValue, "A11");
			Assert.AreEqual (false, cell.EditingCellValueChanged, "A12");
			Assert.AreEqual (null, cell.EditType, "A13");
			Assert.AreEqual (null, cell.FalseValue, "A14");
			Assert.AreEqual (typeof (CheckState), cell.FormattedValueType, "A15");
			Assert.AreEqual (null, cell.IndeterminateValue, "A16");
			Assert.AreEqual (true, cell.ThreeState, "A17");
			Assert.AreEqual (null, cell.TrueValue, "A18");
			Assert.AreEqual (typeof (CheckState), cell.ValueType, "A19");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:28,代码来源:DataGridViewCheckBoxCellTest.cs


示例2: dtgComandos_CellClick

        private void dtgComandos_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0 && e.RowIndex == -1)
            {
                chkTodos.Checked = !chkTodos.Checked;
                chkTodos_Click(chkTodos, null);
            }
            else if (e.ColumnIndex == 0 && e.RowIndex > -1)
            {
                DataGridViewCheckBoxCell ch1 = new DataGridViewCheckBoxCell();
                ch1 = (DataGridViewCheckBoxCell)dtgComandos.Rows[dtgComandos.CurrentRow.Index].Cells[0];

                if (ch1.Value == null)
                    ch1.Value = false;

                switch (ch1.Value.ToString())
                {
                    case "True":
                        ch1.Value = false;
                        break;
                    case "False":
                        ch1.Value = true;
                        break;
                }

                chkTodos.CheckState = StatusComandos();
            }
        }
开发者ID:hempmax,项目名称:AtualDiaria,代码行数:28,代码来源:UscTesteComando.cs


示例3: LoadDetail

        public override void LoadDetail()
        {
            lblTableName.Text = "";
            //lblTableDBDesc.Text = "";//db_desc
            //lblTableLocalDesc.Text = "";//local_desc
            txtTableNewDesc.Text = "";//new_desc
            dgvSchema.Rows.Clear();

            this.node = App.Instance.SelectedNode;
            this.view = App.Instance.SelectedNode.Tag as IViewInfo;

            if (this.view != null)
            {
                lblTableName.Text = this.view.RawName;
                //lblTableDBDesc.Text = this.view.Description;//db_desc
                //lblTableLocalDesc.Text = this.view.Attributes.ContainsKey("local_desc") ? this.view.Attributes["local_desc"] : "";//local_desc
                //txtTableNewDesc.Text = this.view.Attributes.ContainsKey("new_desc") ? this.view.Attributes["new_desc"] : "";//new_desc
                txtTableNewDesc.Text = this.view["local_desc"] ?? "";//local_desc

                //foreach (var item in this.view.Columns)
                //{
                //    int index = dgvSchema.Rows.Add();
                //    DataGridViewRow row = dgvSchema.Rows[index];
                //    //row.Tag = item.IsPrimaryKey;
                //    row.Cells[0].Value = item.RawName;
                //    row.Cells[1].Value = SQLHelper.GetFullSqlType(item);
                //    row.Cells[2].Value = item.Nullable ? true : false;
                //    //row.Cells[3].Value = item.Description;
                //    //row.Cells[4].Value = item.Attributes.ContainsKey("local_desc") ? item.Attributes["local_desc"] : "";
                //    //row.Cells[5].Value = item.Attributes.ContainsKey("new_desc") ? item.Attributes["new_desc"] : "";
                //    row.Cells[3].Value = item["local_desc"] ?? "";
                //}

                List<DataGridViewRow> rlist = new List<DataGridViewRow>();
                foreach (var item in this.view.Columns)
                {
                    DataGridViewTextBoxCell col1 = new DataGridViewTextBoxCell();
                    col1.Value = item.RawName;

                    DataGridViewTextBoxCell col2 = new DataGridViewTextBoxCell();
                    col2.Value = SQLHelper.GetFullSqlType(item);

                    DataGridViewCheckBoxCell col3 = new DataGridViewCheckBoxCell();
                    col3.Value = item.Nullable ? true : false;

                    DataGridViewTextBoxCell col4 = new DataGridViewTextBoxCell();
                    col4.Value = item["local_desc"] ?? "";

                    DataGridViewTextBoxCell col5 = new DataGridViewTextBoxCell();

                    DataGridViewRow row = new DataGridViewRow();
                    row.Cells.AddRange(new DataGridViewCell[] { col1, col2, col3, col4, col5 });
                    rlist.Add(row);
                }

                dgvSchema.Rows.AddRange(rlist.ToArray());
            }
        }
开发者ID:zhh007,项目名称:CKGen,代码行数:58,代码来源:ViewDetail.cs


示例4: Value

		public void Value ()
		{
			DataGridViewCheckBoxCell tbc = new DataGridViewCheckBoxCell ();
			Assert.IsNull (tbc.Value, "#1");
			tbc.Value = string.Empty;
			Assert.AreEqual (string.Empty, tbc.Value, "#2");
			tbc.Value = 5;
			Assert.AreEqual (5, tbc.Value, "#3");
			tbc.Value = null;
			Assert.IsNull (tbc.Value, "#4");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:11,代码来源:DataGridViewCheckBoxCellTest.cs


示例5: AddGenerationParameterAsCheckBox

 private void AddGenerationParameterAsCheckBox(String g, bool v)
 {
     DataGridViewRow r = new DataGridViewRow();
     DataGridViewCell rColumn1 = new DataGridViewTextBoxCell();
     DataGridViewCell rColumn2 = new DataGridViewCheckBoxCell();
     rColumn1.Value = g;
     rColumn2.Value = v;
     r.Cells.Add(rColumn1);
     r.Cells.Add(rColumn2);
     generationParametersTable.Rows.Add(r);
 }
开发者ID:aramazhari,项目名称:complexnetwork,代码行数:11,代码来源:MainWindow.cs


示例6: Chk_Click

        //Fire check checkbox event
        private void Chk_Click(object sender, DataGridViewCellEventArgs e)
        {
            if (I_Table.Columns[e.ColumnIndex].Name == "Chk")
            {
                DataGridViewCheckBoxCell chk = new DataGridViewCheckBoxCell();

                chk = (DataGridViewCheckBoxCell)I_Table.Rows[I_Table.CurrentRow.Index].Cells["Chk"];

                chk.Value = !(bool)chk.Value;
            }
        }
开发者ID:elmon1987,项目名称:weka-implement,代码行数:12,代码来源:Form1.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: 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


示例9: FreshDG

        private void FreshDG()
        {
            DG_In.Rows.Clear();
            DG_Out.Rows.Clear();
            dataset.Clear();
            dataset = ServiceContainer.GetService<IGasDAL>().QueryData("EquipName", "EquipTypeSlet");
            equipTypeNum = dataset.Tables[0].Rows.Count;
            int j = 0;
            foreach (DataRow dr in dataset.Tables[0].Rows)
            {

                DataGridViewRow row = new DataGridViewRow();
                DataGridViewTextBoxCell textboxcell = new DataGridViewTextBoxCell();
                textboxcell.Value = dataset.Tables[0].Rows[j][0];
                row.Cells.Add(textboxcell);
                DataGridViewCheckBoxCell checkcell = new DataGridViewCheckBoxCell();
                checkcell.Value = false;
                row.Cells.Add(checkcell);
                DataGridViewTextBoxCell txtboxcell = new DataGridViewTextBoxCell();
                row.Cells.Add(txtboxcell);
                DG_In.Rows.Add(row);

                DataGridViewRow row2 = new DataGridViewRow();
                DataGridViewTextBoxCell textboxcell2 = new DataGridViewTextBoxCell();
                textboxcell2.Value = dataset.Tables[0].Rows[j][0];
                row2.Cells.Add(textboxcell2);
                DataGridViewCheckBoxCell checkcell2 = new DataGridViewCheckBoxCell();
                checkcell2.Value = false;
                row2.Cells.Add(checkcell2);
                DataGridViewTextBoxCell txtboxcell2 = new DataGridViewTextBoxCell();
                row2.Cells.Add(txtboxcell2);
                DG_Out.Rows.Add(row2);

                //DataGridViewRow row = new DataGridViewRow();
                //row.Cells["设备名称"].Value = dataset.Tables[0].Rows[j][0];//设置row属性
                //DG_In.Rows.Add(row);
                //DG_Out.Rows.Add(row);
                //DG_In.Rows[j].Cells[0].Value = dataset.Tables[0].Rows[j][0];
                //DG_Out.Rows[j].Cells[0].Value = dataset.Tables[0].Rows[j][0];
                j++;
            }
        }
开发者ID:U5732,项目名称:old-version-GasEAS,代码行数:42,代码来源:OmeterAndEquip.cs


示例10: CreateCellTemplate

        DataGridViewCell CreateCellTemplate(System.Reflection.FieldInfo Info)
        {
            DataGridViewCell Cell = new DataGridViewTextBoxCell();
            Type FieldType = Info.FieldType;
            if (FieldType == typeof(bool))
            {
                Cell = new DataGridViewCheckBoxCell();
            }
            //else if (FieldType == typeof(Enum))
            //{
            //    Cell = new DataGridViewTextBoxCell();
            //}
            //else if (   FieldType == typeof(int) || FieldType == typeof(float) || FieldType == typeof(uint) || FieldType == typeof(short) ||
            //            FieldType == typeof(ushort) || FieldType == typeof(byte) || FieldType == typeof(float))
            //{
            //    Cell = new Datagridview
            //}

            return Cell;
        }
开发者ID:przemyslaw-szymanski,项目名称:dungeonworld,代码行数:20,代码来源:CItemGrid.cs


示例11: Clone

 public override object Clone()
 {
     DataGridViewCheckBoxCell cell;
     System.Type type = base.GetType();
     if (type == cellType)
     {
         cell = new DataGridViewCheckBoxCell();
     }
     else
     {
         cell = (DataGridViewCheckBoxCell) Activator.CreateInstance(type);
     }
     base.CloneInternal(cell);
     cell.ThreeStateInternal = this.ThreeState;
     cell.TrueValueInternal = this.TrueValue;
     cell.FalseValueInternal = this.FalseValue;
     cell.IndeterminateValueInternal = this.IndeterminateValue;
     cell.FlatStyleInternal = this.FlatStyle;
     return cell;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:20,代码来源:DataGridViewCheckBoxCell.cs


示例12: BindGrid

        /*============PrivateFunction=======*/

        private void BindGrid()
        {
            dgvChapterList.AutoGenerateColumns = false;

            DataGridViewCell indexCell = new DataGridViewTextBoxCell();
            DataGridViewCell chapterTitleCell = new DataGridViewTextBoxCell();
            DataGridViewCheckBoxCell hasReadCell = new DataGridViewCheckBoxCell();

            DataGridViewTextBoxColumn indexColumn = new DataGridViewTextBoxColumn()
            {
                CellTemplate = indexCell,
                Name = "Index",
                HeaderText = "Index",
                DataPropertyName = "Index",
                Width = 75
            };

            DataGridViewTextBoxColumn titleColumn = new DataGridViewTextBoxColumn()
            {
                CellTemplate = indexCell,
                Name = "ChapterTitle",
                HeaderText = "Chapter Title",
                DataPropertyName = "ChapterTitle",
                Width = 200
            };

            DataGridViewCheckBoxColumn makeAudioColumn = new DataGridViewCheckBoxColumn()
            {
                CellTemplate = hasReadCell,
                Name = "Read",
                HeaderText = "Read",
                DataPropertyName = "Read",
                Width = 75,
            };

            dgvChapterList.Columns.Add(titleColumn);
            dgvChapterList.Columns.Add(indexColumn);
            dgvChapterList.Columns.Add(makeAudioColumn);
        }
开发者ID:TheTerribleChild,项目名称:Windows-Novel-Reader,代码行数:41,代码来源:NovelReaderForm.cs


示例13: ParametersToDataGridView

        public static void ParametersToDataGridView(DataGridView dg,
			IEcasParameterized p, IEcasObject objDefaults)
        {
            if(dg == null) throw new ArgumentNullException("dg");
            if(p == null) throw new ArgumentNullException("p");
            if(p.Parameters == null) throw new ArgumentException();
            if(objDefaults == null) throw new ArgumentNullException("objDefaults");
            if(objDefaults.Parameters == null) throw new ArgumentException();

            dg.Rows.Clear();
            dg.Columns.Clear();

            Color clrBack = dg.DefaultCellStyle.BackColor;
            Color clrValueBack = dg.DefaultCellStyle.BackColor;
            if(clrValueBack.GetBrightness() >= 0.5)
                clrValueBack = UIUtil.DarkenColor(clrValueBack, 0.075);
            else clrValueBack = UIUtil.LightenColor(clrValueBack, 0.075);

            dg.ColumnHeadersVisible = false;
            dg.RowHeadersVisible = false;
            dg.GridColor = clrBack;
            dg.BackgroundColor = clrBack;
            dg.DefaultCellStyle.SelectionBackColor = clrBack;
            dg.DefaultCellStyle.SelectionForeColor = dg.DefaultCellStyle.ForeColor;
            dg.EditMode = DataGridViewEditMode.EditOnEnter;
            dg.AllowDrop = false;
            dg.AllowUserToAddRows = false;
            dg.AllowUserToDeleteRows = false;
            dg.AllowUserToOrderColumns = false;
            dg.AllowUserToResizeColumns = false;
            dg.AllowUserToResizeRows = false;

            int nWidth = (dg.ClientSize.Width - UIUtil.GetVScrollBarWidth());
            dg.Columns.Add("Name", KPRes.FieldName);
            dg.Columns.Add("Value", KPRes.FieldValue);
            dg.Columns[0].Width = (nWidth / 2);
            dg.Columns[1].Width = (nWidth / 2);

            for(int i = 0; i < p.Parameters.Length; ++i)
            {
                EcasParameter ep = p.Parameters[i];

                dg.Rows.Add();
                DataGridViewRow row = dg.Rows[dg.Rows.Count - 1];
                DataGridViewCellCollection cc = row.Cells;

                Debug.Assert(cc.Count == 2);
                cc[0].Value = ep.Name;
                cc[0].ReadOnly = true;

                string strParam = EcasUtil.GetParamString(objDefaults.Parameters, i);
                DataGridViewCell c = null;

                switch(ep.Type)
                {
                    case EcasValueType.String:
                        c = new DataGridViewTextBoxCell();
                        c.Value = strParam;
                        break;

                    case EcasValueType.Bool:
                        c = new DataGridViewCheckBoxCell(false);
                        (c as DataGridViewCheckBoxCell).Value =
                            StrUtil.StringToBool(strParam);
                        break;

                    case EcasValueType.EnumStrings:
                        DataGridViewComboBoxCell cmb = new DataGridViewComboBoxCell();
                        cmb.Sorted = false;
                        cmb.DisplayStyle = DataGridViewComboBoxDisplayStyle.DropDownButton;
                        int iFound = -1;
                        for(int e = 0; e < ep.EnumValues.ItemCount; ++e)
                        {
                            EcasEnumItem eei = ep.EnumValues.Items[e];
                            cmb.Items.Add(eei.Name);
                            if(eei.ID.ToString() == strParam) iFound = e;
                        }
                        if(iFound >= 0) cmb.Value = ep.EnumValues.Items[iFound].Name;
                        else if(ep.EnumValues.ItemCount > 0) cmb.Value = ep.EnumValues.Items[0].Name;
                        else { Debug.Assert(false); }
                        c = cmb;
                        break;

                    case EcasValueType.Int64:
                        c = new DataGridViewTextBoxCell();
                        c.Value = FilterTypeI64(strParam);
                        break;

                    case EcasValueType.UInt64:
                        c = new DataGridViewTextBoxCell();
                        c.Value = FilterTypeU64(strParam);
                        break;

                    default:
                        Debug.Assert(false);
                        break;
                }

                if(c != null) cc[1] = c;
                cc[1].ReadOnly = false;
//.........这里部分代码省略.........
开发者ID:rassilon,项目名称:keepass,代码行数:101,代码来源:EcasUtil.cs


示例14: FreshDG

        private void FreshDG()
        {
            try
            {

                DG_In.Rows.Clear();
                DG_Out.Rows.Clear();
                dataset.Clear();
                dataset = ServiceContainer.GetService<IGasDAL>().QueryData("EquipTypeSlet");
                equipTypeNum = dataset.Tables[0].Rows.Count;

                foreach (DataRow dr in dataset.Tables[0].Rows)
                {
                    if (dr["PorC"].ToString() == "True")
                    {
                        DataGridViewRow row = new DataGridViewRow();
                        DataGridViewTextBoxCell textboxcell = new DataGridViewTextBoxCell();
                        textboxcell.Value = dr[0];
                        row.Cells.Add(textboxcell);
                        DataGridViewCheckBoxCell checkcell = new DataGridViewCheckBoxCell();
                        checkcell.Value = false;
                        row.Cells.Add(checkcell);
                        DataGridViewTextBoxCell txtboxcell = new DataGridViewTextBoxCell();
                        row.Cells.Add(txtboxcell);
                        DG_In.Rows.Add(row);
                    }
                    else
                    {
                        DataGridViewRow row2 = new DataGridViewRow();
                        DataGridViewTextBoxCell textboxcell2 = new DataGridViewTextBoxCell();
                        textboxcell2.Value = dr[0];
                        row2.Cells.Add(textboxcell2);
                        DataGridViewCheckBoxCell checkcell2 = new DataGridViewCheckBoxCell();
                        checkcell2.Value = false;
                        row2.Cells.Add(checkcell2);
                        DataGridViewTextBoxCell txtboxcell2 = new DataGridViewTextBoxCell();
                        row2.Cells.Add(txtboxcell2);
                        DG_Out.Rows.Add(row2);
                    }

                    //DataGridViewRow row = new DataGridViewRow();
                    //row.Cells["设备名称"].Value = dataset.Tables[0].Rows[j][0];//设置row属性
                    //DG_In.Rows.Add(row);
                    //DG_Out.Rows.Add(row);
                    //DG_In.Rows[j].Cells[0].Value = dataset.Tables[0].Rows[j][0];
                    //DG_Out.Rows[j].Cells[0].Value = dataset.Tables[0].Rows[j][0];

                }
            }
            catch(Exception ex)
            {
                Console.WriteLine("查询异常" + ex.Message);
                return;
            }
        }
开发者ID:s20141478,项目名称:WG_Energy2015_11,代码行数:55,代码来源:OmeterAndEquip.cs


示例15: 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


示例16: BindGrid

        /*============PrivateFunction=======*/

        private void BindGrid()
        {
            dgvNovelList.AutoGenerateColumns = false;

            DataGridViewCell novelTitleCell = new DataGridViewTextBoxCell();
            DataGridViewCell rankingCell = new DataGridViewTextBoxCell();
            DataGridViewCell chapterCountCell = new DataGridViewTextBoxCell();
            DataGridViewCell newChapterCountCell = new DataGridViewTextBoxCell();
            DataGridViewCheckBoxCell makeAudioCell = new DataGridViewCheckBoxCell();
            UpdateDataGridViewProgressCell updateProgressCell = new UpdateDataGridViewProgressCell();

            DataGridViewTextBoxColumn novelTitleColumn = new DataGridViewTextBoxColumn()
            {
                CellTemplate = novelTitleCell,
                Name = "NovelTitle",
                HeaderText = "Novel Title",
                DataPropertyName = "NovelTitle",
                Width = 200,
                ReadOnly = true
            };

            DataGridViewTextBoxColumn rankingColumn = new DataGridViewTextBoxColumn()
            {
                CellTemplate = rankingCell,
                Name = "Rank",
                HeaderText = "Rank",
                DataPropertyName = "Rank",
                Width = 100,
                ReadOnly = true
            };

            DataGridViewTextBoxColumn chapterCountColumn = new DataGridViewTextBoxColumn()
            {
                CellTemplate = chapterCountCell,
                Name = "ChapterCount",
                HeaderText = "Chapter Count",
                DataPropertyName = "ChapterCount",
                Width = 150,
                ReadOnly = true
            };

            DataGridViewTextBoxColumn newChapterCountColumn = new DataGridViewTextBoxColumn()
            {
                CellTemplate = newChapterCountCell,
                Name = "NewChapterCount",
                HeaderText = "New Chapter Count",
                DataPropertyName = "NewChapterCount",
                Width = 150,
                ReadOnly = true
            };

            DataGridViewComboBoxColumn stateColumn = new DataGridViewComboBoxColumn()
            {
                Name = "State",
                HeaderText = "State",
                DataPropertyName = "State",
                DataSource = Enum.GetValues(typeof(Novel.NovelState)),
                ValueType = typeof(Novel.NovelState),
                Width = 100
            };

            DataGridViewCheckBoxColumn makeAudioColumn = new DataGridViewCheckBoxColumn()
            {
                CellTemplate = makeAudioCell,
                Name = "MakeAudio",
                HeaderText = "Make Audio",
                DataPropertyName = "MakeAudio",
                Width = 100,
            };

            UpdateDataGridViewProgressColumn updateProgressColumn = new UpdateDataGridViewProgressColumn()
            {
                CellTemplate = updateProgressCell,
                Name = "UpdateProgress",
                HeaderText = "Update Progress",
                DataPropertyName = "UpdateProgress",
                Width = 100,
            };
            
            dgvNovelList.Columns.Add(novelTitleColumn);
            dgvNovelList.Columns.Add(rankingColumn);
            dgvNovelList.Columns.Add(chapterCountColumn);
            dgvNovelList.Columns.Add(newChapterCountColumn);
            dgvNovelList.Columns.Add(stateColumn);
            dgvNovelList.Columns.Add(makeAudioColumn);
            dgvNovelList.Columns.Add(updateProgressColumn);

            dgvNovelList.DataSource = NovelLibrary.Instance.NovelList;


        }
开发者ID:TheTerribleChild,项目名称:Windows-Novel-Reader,代码行数:93,代码来源:NovelListController.cs


示例17: CostCodeSelector_Load

        private void CostCodeSelector_Load(object sender, EventArgs e)
        {
            try
            {
                // get a list of cost codes
                var codes = Accounting.GetCostCodes();

                var _selected = Env.GetConfigVar("nonbillablecostcodes", "0", true).Split(',').Where(c => c != "");
                var selected = _selected.Select(c => decimal.Parse(c));
                Data = (from code in codes
                            select new
                            {
                                NonBillable = selected.Contains(code.Recnum),
                                CostCode = code.Recnum,
                                Description = code.Description,
                            }).ToDataTable("codes");

                this.dataGridView1.DataSource = Data;
                var ctemplate = new DataGridViewCheckBoxCell();
                this.dataGridView1.Columns["NonBillable"].CellTemplate = ctemplate;
                this.dataGridView1.Columns["Description"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                this.dataGridView1.AutoResizeColumns();
                this.Deactivate += new EventHandler(CostCodeSelector_Deactivate);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:vimalgupta1980,项目名称:2165-SMB-T-M-Job-Detail-Analysis,代码行数:29,代码来源:CostCodeSelector.cs


示例18: addVMNodeToGrid

        private void addVMNodeToGrid(string nodeName, string powerState)
        {
            var addPowerStateCol = new Action(() =>
            {
                if (!serverGridView.Columns.Contains("VM Power State"))
                {
                    DataGridViewTextBoxColumn powerStateCol = new DataGridViewTextBoxColumn();
                    powerStateCol.DataPropertyName = "VM Power State";
                    powerStateCol.HeaderText = "VM Power State";
                    powerStateCol.Name = "VM Power State";
                    powerStateCol.SortMode = DataGridViewColumnSortMode.Programmatic;
                    serverGridView.Columns.Add(powerStateCol);
                }
                var row = new DataGridViewRow();
                var c = new DataGridViewCheckBoxCell();
                c.Value = true;
                row.Cells.Add(c);

                var s = new DataGridViewTextBoxCell();
                s.Value = nodeName;
                row.Cells.Add(s);
                int index = serverGridView.Rows.Add(row);
                serverGridView.Rows[index].Cells["VM Power State"].Value = powerState;
            });
            condInvoke(addPowerStateCol);
        }
开发者ID:obsoleter,项目名称:Commands-and-Stats,代码行数:26,代码来源:MainForm.cs


示例19: CreateNewRow

 private DataRow CreateNewRow(DataTable dt)
 {
     DataRow dr;
     List<object> items = new List<object>();
     dr = dt.NewRow();
     DataGridViewRow row;
     DataGridViewCell cell;
     DataColumn primaryKeyColumn = dt.PrimaryKey.Length == 0 ? null : dt.PrimaryKey[0];
     for (int i = 0; i < dt.Columns.Count; i++) {
         row = new DataGridViewRow();
         foreach (DataRelation dataRel in dt.ParentRelations) {
             if (dataRel.ChildColumns[0] == dt.Columns[i]) {
                 cell = new DataGridViewComboBoxCell();
                 foreach (DataRow drR in dbFile.Tables[dataRel.ParentColumns[0].Table.TableName].Rows) {
                     if (drR.RowState != DataRowState.Deleted) {
                         ((DataGridViewComboBoxCell)cell).Items.Add(drR.ItemArray[dataRel.ParentColumns[0].Ordinal]);
                     }
                     if (((DataGridViewComboBoxCell)cell).Items.Count > 0) {
                         break;
                     }
                 }
                 row.Cells.Add(cell);
                 break;
             }
         }
         if (row.Cells.Count == 0) {
             row.Cells.Clear();
             if (dt.Columns[i].DataType == typeof(bool)) {
                 cell = new DataGridViewCheckBoxCell();
                 row.Cells.Add(cell);
             } else if (dt.Columns[i].DataType == typeof(string)) {
                 cell = new DataGridViewTextBoxCell();
                 row.Cells.Add(cell);
             } else if (dt.Columns[i].DataType == typeof(int) || dt.Columns[i].DataType == typeof(float)) {
                 cell = new DataGridViewTextBoxCell();
                 row.Cells.Add(cell);
             } else {
                 cell = new DataGridViewTextBoxCell();
                 row.Cells.Add(cell);
             }
         }
         if (row.Cells[0] is DataGridViewComboBoxCell) {
             if (((DataGridViewComboBoxCell)row.Cells[0]).Items.Count > 0) {
                 ((DataGridViewComboBoxCell)row.Cells[0]).Value = ((DataGridViewComboBoxCell)row.Cells[0]).Items[0];
             } else {
                 ((DataGridViewComboBoxCell)row.Cells[0]).Items.Add(dt.Columns[i].DefaultValue);
                 ((DataGridViewComboBoxCell)row.Cells[0]).Value = dt.Columns[i].DefaultValue;
             }
         } else {
             row.Cells[0].Value = dt.Columns[i].DefaultValue;
         }
         row.Cells[0].ValueType = dt.Columns[i].DataType;
         // Set Up PrimaryKey Row Values for Validation
         if (dt.Columns[i] == primaryKeyColumn) {
             int largestIndex = 1;
             foreach (DataRow dRPK in dt.Rows) {
                 if (dRPK.RowState != DataRowState.Deleted) {
                     if (dRPK.ItemArray[i] is int) {
                         largestIndex = Math.Max(largestIndex, (int)dRPK.ItemArray[i]);
                     }
                 }
             }
             if (row.Cells[0].ValueType == typeof(int)) {
                 row.Cells[0].Value = largestIndex + 1;
             }
         }
         items.Add(row.Cells[0].Value);
     }
     // Finish
     dr.ItemArray = items.ToArray();
     return dr;
 }
开发者ID:BennyKJohnson,项目名称:Ego-Engine-Modding,代码行数:72,代码来源:Form1.cs


示例20: SrRow

            public SrRow(SR.SRInfo srInfo, SR.SRTypes type, bool poolMetadataDetected, bool selected)
            {
                SrInfo = srInfo;
                HasMetadata = poolMetadataDetected;

                var cellTick = new DataGridViewCheckBoxCell { Value = selected };
                var cellName = new DataGridViewTextBoxCell { Value = srInfo.Name };
                var cellDesc = new DataGridViewTextBoxCell { Value = srInfo.Description };
                var cellType = new DataGridViewTextBoxCell { Value = SR.getFriendlyTypeName(type) };
                var cellMetadata = new DataGridViewTextBoxCell { Value = poolMetadataDetected.ToStringI18n() };
                Cells.AddRange(cellTick, cellName, cellDesc, cellType, cellMetadata);
            }
开发者ID:huizh,项目名称:xenadmin,代码行数:12,代码来源:DRFailoverWizardStoragePage.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Forms.DataGridViewCheckBoxColumn类代码示例发布时间:2022-05-26
下一篇:
C# Forms.DataGridViewCellValueEventArgs类代码示例发布时间: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