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


C# Forms.DataGridViewButtonColumn类代码示例

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


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

示例1: SearchButton_Click

        private void SearchButton_Click(object sender, EventArgs e)
        {
            CargarRoles();

            if (TablaRoles.Rows.Count == 0)
            {
                MessageBox.Show("No se han encontrado roles");
                return;
            }

            this.DataGrid_Roles.Columns.Clear();
            this.DataGrid_Roles.DataSource = TablaRoles;
            this.DataGrid_Roles.Visible = true;
            this.DataGrid_Roles.Columns["id_Rol"].Visible = false;
            this.DataGrid_Roles.Columns["isActive"].Visible = false;
            DataGridViewButtonColumn btn = new DataGridViewButtonColumn();
            this.DataGrid_Roles.Columns.Add(btn);
            btn.HeaderText = "Action";

            if (Flag_deletion)
            {
                btn.Text = "Delete";
            }
            else
            {
                btn.Text = "Select";
            }
            
            btn.Name = "row_button";
            btn.UseColumnTextForButtonValue = true;
        }
开发者ID:ccantero,项目名称:gdatos_EnerLand,代码行数:31,代码来源:SearchRol.cs

示例2: AddButtonColumn

        public static void AddButtonColumn(DataGridView grid,bool IsAddColumn)
        {
            if (!IsAddColumn)
            {
                System.Windows.Forms.DataGridViewCellStyle buttonCellStyle = new System.Windows.Forms.DataGridViewCellStyle();
                buttonCellStyle.BackColor = System.Drawing.Color.Silver;

                DataGridViewButtonColumn getNewColumn = new DataGridViewButtonColumn();
                getNewColumn.DefaultCellStyle = buttonCellStyle;
                getNewColumn.HeaderText = "取新";
                getNewColumn.Name = "NewButton";
                getNewColumn.UseColumnTextForButtonValue = true;
                getNewColumn.Text = "取新";
                getNewColumn.Width = 60;
                grid.Columns.Add(getNewColumn);

                DataGridViewButtonColumn getOldColumn = new DataGridViewButtonColumn();
                getOldColumn.DefaultCellStyle = buttonCellStyle;
                getOldColumn.Name = "OldButton";
                getOldColumn.UseColumnTextForButtonValue = true;
                getOldColumn.HeaderText = "取旧";
                getOldColumn.Text = "取旧";
                getOldColumn.Width = 60;
                grid.Columns.Add(getOldColumn);
            }
        }
开发者ID:BlueSky007,项目名称:Demo55,代码行数:26,代码来源:GridControl.cs

示例3: hacerQuery

        public void hacerQuery(string query, DataGridView dataGrid)
        {
            ConexionSQL conn = new ConexionSQL();
            DataTable dt = conn.cargarTablaSQL(query);
            if (dataGrid.DataSource != null) dataGrid.Columns.Remove("seleccionar");

            dataGrid.DataSource = dt;

            if (dt.Rows.Count == 0)
            {
                MessageBox.Show("No se han encontrado resultados en la consulta", "Fallo la busqueda", MessageBoxButtons.OK);
                dataGrid.DataSource = null;

            }
            else
            {
                DataGridViewButtonColumn boton = new DataGridViewButtonColumn();
                boton.Name = "Seleccionar";
                boton.HeaderText = "Seleccionar";
                boton.Text = "Seleccionar";
                boton.UseColumnTextForButtonValue = true;
                dataGrid.Columns.Insert(dataGrid.Columns.Count, boton);
                dataGrid.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None;
                dataGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
                dataGrid.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
            }
        }
开发者ID:Leonardo-Rocca,项目名称:TP-GDD-Aerolinea,代码行数:27,代码来源:ModificarEliminarRuta.cs

示例4: buttonOpenXml_Click

        private void buttonOpenXml_Click(object sender, EventArgs e)
        {
            #region 打开文件
            OpenFileDialog _fileDialog = new OpenFileDialog();
            _fileDialog.Title = "请选择一个数据文件";
            _fileDialog.FileName = "";
            _fileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            _fileDialog.Filter = "Xml 文件(*.xml)|*.xml";
            _fileDialog.ValidateNames = true;
            _fileDialog.CheckFileExists = true;
            _fileDialog.CheckPathExists = true;

            string _strName = "";

            if (_fileDialog.ShowDialog() == DialogResult.OK)
            {
                _strName = _fileDialog.FileName;
                this.textBoxXmlPath.Text = _strName;
            }

            if (_strName == "")
            {
                return;
            }
            #endregion

            #region 后续文件操作
            this.treeView.Nodes.Clear();
            this.LoadXml(_strName);
            DataGridViewButtonColumn _col = new DataGridViewButtonColumn();
            _col.HeaderText = "";
            #endregion
        }
开发者ID:showermj,项目名称:ExcelToXml,代码行数:33,代码来源:ExcelToXml.cs

示例5: FrmInscripcion

        public FrmInscripcion()
        {
            InitializeComponent();
            ConfigureForm();
            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.AutoSize = true;
            dataGridView1.DataSource = bindingSource1;

            DataGridViewColumn column = new DataGridViewTextBoxColumn();
            column.DataPropertyName = "NOMBRE";
            column.Name = "NOMBRE";
            dataGridView1.Columns.Add(column);

            column = new DataGridViewCheckBoxColumn();
            column.DataPropertyName = "CARRERA";
            column.Name = "CARRERA";
            dataGridView1.Columns.Add(column);

            column = new DataGridViewCheckBoxColumn();
            column.DataPropertyName = "NIVEL";
            column.Name = "NIVEL";
            dataGridView1.Columns.Add(column);

            DataGridViewButtonColumn column2 = new DataGridViewButtonColumn();
            column2.DataPropertyName = "INSCRIBIR";
            column2.Name = "INSCRIBIR";
            column2.HeaderText = "INSCRIBIR";
            column2.ToolTipText = "INSCRIBIR";
            dataGridView1.Columns.Add(column2);
        }
开发者ID:antonianemi,项目名称:FULL,代码行数:30,代码来源:FrmInscripcion.cs

示例6: charger_utilisateur

        private void charger_utilisateur()
        {
            requete = "select * from Utilisateur where pseudo='"+login.ToString()+"' and motDePasse='"+mot_pass.ToString()+"'";

            DataSet utilisateur = MaConnexion.ExecuteSelect(connectionString, requete);
            if (utilisateur != null)
            {
                foreach (DataRow row in utilisateur.Tables[0].Rows)
                {
                    Login.Text = row[1].ToString();
                    Password.Text = row[2].ToString();
                    NOM.Text = row[3].ToString();
                    Prenom.Text = row[4].ToString();
                    id_utilisateur = int.Parse(row[0].ToString());

                }
            }

            requete = "select priv,droit from attribuer join privilege  on attribuer.id_priv= privilege.id_priv join droit on droit.id_droit=attribuer.id_droit and  id_utilisateur=" + id_utilisateur;

               DataSet privilege = MaConnexion.ExecuteSelect(connectionString, requete);
               dgvDroits.DataSource = privilege.Tables[0];
               DataGridViewButtonColumn col = new DataGridViewButtonColumn();
               dgvDroits.Columns.Add(col);
        }
开发者ID:kimboox44,项目名称:inventaire,代码行数:25,代码来源:modifier_utilisateur.cs

示例7: cargarTurnos

 // Método para cargar turnos del profesional
 private void cargarTurnos()
 {
     int fecha = 0;
     int fechaMas1 = 0;
     int minutosMas15 = @Clinica_Frba.Properties.Settings.Default.Fecha.Minute + 15;
     fecha += @Clinica_Frba.Properties.Settings.Default.Fecha.Day;
     fecha += @Clinica_Frba.Properties.Settings.Default.Fecha.Month * 100;
     fecha += @Clinica_Frba.Properties.Settings.Default.Fecha.Year * 10000;
     fechaMas1 = fecha + 1;
     SqlConnection conexion = SQL_Methods.IniciarConnection();
     string query = "SELECT Cod_Turno, Fecha FROM ORACLE_FANS.Turnos " +
                    "WHERE Matricula = " + matricula.Text + " " +
                    "AND habilitado = 0 " +
                    "AND Fecha >= '" + fecha.ToString() + " " + @Clinica_Frba.Properties.Settings.Default.Fecha.Hour.ToString() + ":" + minutosMas15.ToString() + ":" + @Clinica_Frba.Properties.Settings.Default.Fecha.Second.ToString() + "' " +
                    "AND Fecha < '" + fechaMas1.ToString() + "'";
     turnos = SQL_Methods.EjecutarProcedure(conexion, query);
     dataGridView1.Columns.Clear();
     dataGridView1.AllowUserToAddRows = false;
     dataGridView1.DataSource = turnos;
     dataGridView1.Visible = true;
     DataGridViewButtonColumn boton = new DataGridViewButtonColumn();
     this.dataGridView1.Columns.Add(boton);
     boton.HeaderText = "Action";
     boton.Text = "Ingresar Afiliado";
     boton.Name = "row_button";
     boton.UseColumnTextForButtonValue = true;
     dataGridView1.Columns[1].Width = 150;
     dataGridView1.Columns[2].Width = 100;
 }
开发者ID:ccantero,项目名称:gdatos_EnerLand,代码行数:30,代码来源:RegistroLlegadaForm.cs

示例8: InitializeGridView

        //初始化GridView
        private void InitializeGridView()
        {
            DataGridViewButtonColumn deleteBtn = new DataGridViewButtonColumn();
            deleteBtn.Text = "X";
            deleteBtn.Name = "deleteBtn";
            deleteBtn.UseColumnTextForButtonValue = true;
            deleteBtn.HeaderText = "remove";
            deleteBtn.Width = 50;
            deleteBtn.DisplayIndex = 2;

            _windowGridView.Columns.Add(deleteBtn);
            DataGridViewButtonColumn editBtn = new DataGridViewButtonColumn();
            editBtn.Text = "Edit";
            editBtn.Name = "editBtn";
            editBtn.UseColumnTextForButtonValue = true;
            editBtn.HeaderText = "edit";
            editBtn.Width = 50;
            editBtn.DisplayIndex = 3;

            _windowGridView.Columns.Add(editBtn);
            _windowGridView.Columns["GetImage"].HeaderText = "icon";
            _windowGridView.Columns["IsEnable"].HeaderText = "enable";
            _windowGridView.Columns["Name"].HeaderText = "name";
            _windowGridView.Columns["IsOpen"].Visible = false;
        }
开发者ID:shana0440,项目名称:easy-control-myo-sharp,代码行数:26,代码来源:EasyControl.cs

示例9: BuscarPedidos

        private DataSet numMarca; //usado en funcion TModelos

        #endregion Fields

        #region Constructors

        public BuscarPedidos()
        {
            InitializeComponent();

            EN.ENPedidos enPedido = new EN.ENPedidos();
            DataSet dsMarc = new DataSet();
            dsMarc = enPedido.ObtenerListaMarcas();

            numMarca = new DataSet();
            numMarca = dsMarc;

            DataGridViewButtonColumn buttons = new DataGridViewButtonColumn();
            {
                buttons.HeaderText = "Editar"; //texto de la columna
                buttons.Text = "Editar"; //texto de cada boton, sale al introducir texto
                buttons.UseColumnTextForButtonValue = true;
                buttons.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                buttons.FlatStyle = FlatStyle.Standard;
                buttons.CellTemplate.Style.BackColor = Color.Honeydew;
                buttons.DisplayIndex = 0;
            }

            DataGridViewCheckBoxColumn boton = new DataGridViewCheckBoxColumn();
            {
                boton.HeaderText = "Eliminar";//texto de la columna
                boton.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; //tamaño
                boton.DisplayIndex = 0; //indice que ocupara en la tabla
            }

            TDataGridViewPedidos.Columns.Add(boton);
            TDataGridViewPedidos.Columns.Add(buttons);
        }
开发者ID:angelguit,项目名称:dpaa-alquilercoches,代码行数:38,代码来源:BuscarPedidos.cs

示例10: BindFieldRangeGrid

        void BindFieldRangeGrid()
        {
            try
            {
                dataGridView1.DataSource = null;
                dataGridView1.Columns.Clear();


                dataGridView1.DataSource = rangeList;

                dataGridView1.EnableHeadersVisualStyles = false;

                if (dataGridView1.Rows.Count > 0)
                {
                    dataGridView1.Rows[0].Cells[0].Selected = false;
                }

                DataGridViewButtonColumn deleteButtonColumn = new DataGridViewButtonColumn();
                deleteButtonColumn.HeaderText = "";
                deleteButtonColumn.Name = "delete_column";
                deleteButtonColumn.Text = "Delete";
                deleteButtonColumn.UseColumnTextForButtonValue = true;

                if (dataGridView1.Columns["delete_column"] == null)
                {
                    dataGridView1.Columns.Add(deleteButtonColumn);
                }


            }
            catch (Exception)
            {
                throw;
            }
        }
开发者ID:shoaib-ijaz,项目名称:geosoft,代码行数:35,代码来源:RangeRulesControl.cs

示例11: agregarBotonesDGV

        private void agregarBotonesDGV()
        {
            var modificar = new DataGridViewButtonColumn
            {
                Text = "Modificar",
                UseColumnTextForButtonValue = true,
                AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
            };
            var bajaServicio = new DataGridViewButtonColumn
            {
                Text = "Fuera de Servicio",
                UseColumnTextForButtonValue = true,
                AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
            };
            var bajaDefinitiva = new DataGridViewButtonColumn
            {
                Text = "Baja Definitiva",
                UseColumnTextForButtonValue = true,
                AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
            };

            dgvAeronaves.Columns.Add(modificar);
            dgvAeronaves.Columns.Add(bajaServicio);
            dgvAeronaves.Columns.Add(bajaDefinitiva);
        }
开发者ID:MatiGoldman,项目名称:gestionDeDatos,代码行数:25,代码来源:frmABMAeronave.cs

示例12: init

        public void init(string database, string username)
        {
            DataSet ds;
            DataGridViewButtonColumn dtGridBt = new DataGridViewButtonColumn();
            datafile = database;
            dtGridUser.AllowUserToAddRows = true;
            int i, cullCount;
            string sqlString = "SELECT [Username] AS [Ten nguoi dung], [Locked] AS [Khoa] FROM [QUANLYUSER]";
            dbUser = new db(database);
            ds = dbUser.genDataset(sqlString);
            dtGridUser.DataSource = ds.Tables[0];
            dtGridBt.Width = 60;
            dtGridBt.Text = "Cap nhat";
            dtGridBt.Name = "capnhat";
            dtGridBt.UseColumnTextForButtonValue = true;
            for (i = 0; i < dtGridUser.Columns.Count; i++)
            {
                dtGridUser.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
                dtGridUser.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;

            }
            dtGridUser.Columns.Add(dtGridBt);
            cullCount = dtGridUser.Columns.Count;
            for (i = 0; i < dtGridUser.Rows.Count; i++)
            {
                dtGridUser.Rows[i].Cells[cullCount - 1].Value = "Cap nhat";
            }
            dtGridUser.AllowUserToAddRows = false;
            if (username != "admin")
                cmdDelete.Enabled = false;
        }
开发者ID:ViniciusConsultor,项目名称:quanlydongtien,代码行数:31,代码来源:Quanlynguoidung.cs

示例13: Book

        public Book(DataTable table)
            : this()
        {
            BindingSource bs = new BindingSource();
            bs.DataSource = table;
            dgvBook.DataSource = bs;
            dgvBook.Columns["ID"].Visible = false;
            dgvBook.Columns["Name"].HeaderText = "Наименование";
            // Автозаполнение только для одной колонки, в будущем возможно потребуется сделать для всех (в цикле)
            dgvBook.Columns["Name"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            if (dgvBook.Columns.Contains("IconPath"))
                dgvBook.Columns["IconPath"].HeaderText = "Иконка";

            // Только для справочника Осадки, добавление колонки с кнопкой
            // TODO: 2014-08-30 Disable ToolTip for buttons
            var buttonColumn = new DataGridViewButtonColumn();
            buttonColumn.Name = "SelectIconBtn";
            buttonColumn.HeaderText = string.Empty;
            buttonColumn.Width = 22;
            buttonColumn.UseColumnTextForButtonValue = true;
            buttonColumn.Text = "...";
            if (table.TableName == "fallout")
            {
                dgvBook.Columns.Add(buttonColumn);
            }
            dgvBook.CellContentClick += dgvBook_CellContentClick;
        }
开发者ID:roxocode,项目名称:wether_diary,代码行数:27,代码来源:Book.cs

示例14: filldatagrid

        public void filldatagrid()
        {
            computersDataGrid.Rows.Clear();
            computersDataGrid.Columns.Clear();

            DataGridViewCell cellStyle = new DataGridViewTextBoxCell();
            cellStyle.Style.BackColor = Color.Wheat;

            DataGridViewButtonColumn deleteButtonColumn = new DataGridViewButtonColumn();

            deleteButtonColumn.Text = "Delete Computer";
            deleteButtonColumn.UseColumnTextForButtonValue = true;

            DataGridViewButtonColumn updateButtonColumn = new DataGridViewButtonColumn();
            updateButtonColumn.Text = "Update Computer";

            updateButtonColumn.UseColumnTextForButtonValue = true;

            DataGridViewButtonColumn viewComputerButtonColumn = new DataGridViewButtonColumn();
            viewComputerButtonColumn.Text = "View computer details";
            viewComputerButtonColumn.UseColumnTextForButtonValue = true;

            DataGridViewButtonColumn moveComputerButtonColumn = new DataGridViewButtonColumn();
            moveComputerButtonColumn.Text = "Move computer";
            moveComputerButtonColumn.UseColumnTextForButtonValue = true;

            computersDataGrid.Columns.Add(new DataGridViewColumn(cellStyle));
            computersDataGrid.Columns.Add(updateButtonColumn);
            computersDataGrid.Columns.Add(deleteButtonColumn);
            computersDataGrid.Columns.Add(viewComputerButtonColumn);
            computersDataGrid.Columns.Add(moveComputerButtonColumn);

            foreach (Computer comp in classroom.Computersinclassroom)
                computersDataGrid.Rows.Add(comp.Computername);
        }
开发者ID:TheGer,项目名称:Examples,代码行数:35,代码来源:ManageComputersForm.cs

示例15: btnBusqueda_Click

        private void btnBusqueda_Click(object sender, EventArgs e)
        {
            string queryFinal = "SELECT R.Rol_Id,R.Rol_Desc,R.Rol_estado FROM NENE_MALLOC.Rol R, NENE_MALLOC.Funcionalidad F ";
            Boolean condicion = false;
            string condiciones = " WHERE ";
            if (!string.IsNullOrEmpty(txtNomRol.Text))
            {
                condicion = true;
                queryFinal += condiciones+ " R.Rol_Desc LIKE '%"+txtNomRol.Text+"%'";
            }
            if (cBFuncionalidades.SelectedIndex != -1)
            {
                if (condicion) { queryFinal += " AND F.Func_Desc LIKE '%" + cBFuncionalidades.SelectedItem.ToString() + "%'"; }
                else
                {
                    condicion = true;
                    queryFinal += condiciones +"  F.Func_Desc LIKE '%" + cBFuncionalidades.SelectedItem.ToString() + "%'"; }

            }
            if (cBEstadoRol.SelectedIndex != -1)
            {
                if (condicion) { queryFinal += " AND R.Rol_Estado LIKE '%" + cBEstadoRol.SelectedItem.ToString() + "%'"; }
                else { queryFinal += condiciones+"  R.Rol_Estado LIKE '%" + cBEstadoRol.SelectedItem.ToString() + "%'"; }

            }
            queryFinal += " GROUP BY R.Rol_Id,R.Rol_Desc,R.Rol_estado";
              dataGridView1.DataSource =  conexion.consulta(queryFinal);
              DataGridViewButtonColumn col = new DataGridViewButtonColumn();
              col.UseColumnTextForButtonValue = true;
              col.Text = "Seleccionar";
              col.Name = "Seleccionar";
              dataGridView1.Columns.Add(col);
        }
开发者ID:gastitan,项目名称:NENE_MALLOC,代码行数:33,代码来源:ListadoRol.cs


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