Inheritance: DataGridViewButtonColumn
Example #1
1
 public SquadForm(DbConnect postgreConnect, DataSet globalDS, int squadID = -1)
 {
     InitializeComponent();
     cbColumn = new DataGridViewCheckBoxColumn();
     cbColumn.HeaderText = "Является сотрудником отряда";
     cbColumn.DataPropertyName = "is_in_squad";
     cbColumn.FillWeight = 40;
     cbColumn.ReadOnly = false;
     dataSet1 = globalDS;
     postgreConnection = postgreConnect;
     squadSelectBS.DataSource = dataSet1.Tables["squad"];
     listBox1.DataSource = dataSet1.Tables["squad"];
     listBox1.DisplayMember = "name";
     listBox1.ValueMember = "id";
     initEnd = true;
     if (listBox1.SelectedValue != null)
         ChangeSelectedSquad(int.Parse(listBox1.SelectedValue.ToString()));
     else
         DeactivateAllButtons();
     SetButtonPermissions();
     if (squadID != -1)
         listBox1.SelectedValue = squadID;
     bindingNavigator2.BindingSource = selectionsDataBS;
     bindingNavigator1.BindingSource = employeesAddBS;
     dataGridView1.DataSource = selectionsDataBS;
 }
        public void LoadListaVariaveis(List<MaquinaInequacoesServiceReference.Variavel> variaveis)
        {
            dataGridView3.AutoGenerateColumns = false;
            dataGridView3.DataSource = variaveis;

            DataGridViewCheckBoxColumn chk = new DataGridViewCheckBoxColumn();
            chk.HeaderText = "X";
            chk.Name = "chkVariaveis";
            dataGridView3.Columns.Add(chk);
            //dataGridView3.Columns.Add(CreateComboBoxOrdem());

            DataGridViewColumn column = new DataGridViewTextBoxColumn();
            column.DataPropertyName = "Nome";
            column.Name = "Variavel";
            dataGridView3.Columns.Add(column);

            /*
            DataGridViewComboBoxColumn cmb = new DataGridViewComboBoxColumn();
            cmb.HeaderText = "Ordem";
            cmb.Name = "cmbOrdem";
            cmb.MaxDropDownItems = 100;
            for (int i = 0; i < 100; i++)
            {
                cmb.Items.Add(i);
            }
            dataGridView3.Columns.Add(cmb);

            foreach (DataGridViewRow row in dataGridView3.Rows)
            {
                row.Cells[chk.Name].Value = false;
                //(row.Cells[cmb.Name] as DataGridViewComboBoxCell).Value = 0;
            }
            */
        }
Example #3
0
        public DataGridView agregarBotones(DataGridView dataGridView, String tipo)
        {
            if (tipo == "SELECCIONAR")
            {
                DataGridViewCheckBoxColumn ColumnaSeleccionar = new DataGridViewCheckBoxColumn();
                ColumnaSeleccionar.HeaderText = "SEL";
                ColumnaSeleccionar.Name = "SELECCIONAR";
                ColumnaSeleccionar.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                ColumnaSeleccionar.FlatStyle = FlatStyle.Standard;
                ColumnaSeleccionar.DisplayIndex = dataGridView.Columns.Count;
                ColumnaSeleccionar.CellTemplate.Style.BackColor = Color.Honeydew;
                ColumnaSeleccionar.Width = 80;
                if (dataGridView.Columns["SELECCIONAR"] == null)
                {
                    dataGridView.Columns.Add(ColumnaSeleccionar);
                }
                else
                {
                    dataGridView.Columns.Remove(dataGridView.Columns["Seleccionar"]);
                    dataGridView.Columns.Add(ColumnaSeleccionar);
                }
            }

            return dataGridView;
        }
 private void CreateDataGridViewCell(DataGridView dataGridView, string[] rows, string[] columns, bool readOnly)
 {
     dataGridView.Columns.Clear();
     dataGridView.Rows.Clear();
     DataGridViewColumnCollection matrixColumns = dataGridView.Columns;
     matrixColumns.Add("nullColumn", "");
     for (int j = 0; j < columns.Length; j++)
     {
         DataGridViewCheckBoxColumn checkColumn = new DataGridViewCheckBoxColumn();
         checkColumn.Name = "testColumn";
         checkColumn.HeaderText = columns[j];
         checkColumn.TrueValue = true;
         checkColumn.FalseValue = false;
         checkColumn.FillWeight = 10;
         checkColumn.ReadOnly = readOnly;
         checkColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
         matrixColumns.Add(checkColumn);
     }
     DataGridViewRowCollection matrixRows = dataGridView.Rows;
     for (int i = 0; i < rows.Length; i++)
     {
         matrixRows.Add(rows[i]);
     }
     dataGridView.Columns[0].Frozen = true;
     dataGridView.Columns[0].ReadOnly = true;
     dataGridView.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
 }
        private void frm_SelectStudent_Load(object sender, EventArgs e)
        {
            ob = new class_Application();
            s = "select user_id,user_name from user_access";
            ds = ob.fill_data_set(s);


            DataGridViewCheckBoxColumn chk = new DataGridViewCheckBoxColumn();
            dataGridView1.Columns.Add("user_id", "USER ID");
            dataGridView1.Columns.Add("user_name", "USER NAME");
            dataGridView1.Columns.Add(chk);
            dataGridView1.Columns[2].HeaderText = "SELECT";
            dataGridView1.Columns[2].Name = "select";
            dataGridView1.RowHeadersVisible = false;
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            dataGridView1.Columns[0].SortMode = DataGridViewColumnSortMode.Programmatic;
            dataGridView1.Columns[1].SortMode = DataGridViewColumnSortMode.Programmatic;
            dataGridView1.Columns[2].SortMode = DataGridViewColumnSortMode.Programmatic;



            dataGridView1.Rows.Add(ds.Tables[0].Rows.Count);
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {   dataGridView1.Rows[i].Cells["user_id"].Value = ds.Tables[0].Rows[i]["user_id"];
                dataGridView1.Rows[i].Cells["user_name"].Value = ds.Tables[0].Rows[i]["user_name"];
            }


        }
 public static DataGridViewColumn CreateColumn( DataGridViewColumnType columnType, String columnName, String columnText)
 {
     DataGridViewColumn col = null;
     switch (columnType)
     {
         case DataGridViewColumnType.MULTICOMBOBOX:
             col = new DataGridViewMultiColumnComboBoxColumn();
             break;
         case DataGridViewColumnType.COMBOBOX:
             col = new DataGridViewComboBoxColumn();
             break;
         case DataGridViewColumnType.TIME:
             col = new DataGridViewTimeColumn();
             break;
         case DataGridViewColumnType.DATE:
             col = new DataGridViewDateTimeColumn();
             break;
         case DataGridViewColumnType.CHECKBOX:
             col = new DataGridViewCheckBoxColumn();
             break;
         case DataGridViewColumnType.NUMBER:
         default:
             col = new DataGridViewTextBoxColumn();
             break;
     }
     col.DataPropertyName = columnName;
     col.Name = columnName;
     col.HeaderText = columnText;
     return col;
 }
Example #7
0
        private void BuildDataGridViewStructure()
        {
            dgvList.AllowUserToAddRows = false;
            dgvList.MultiSelect = false;
            dgvList.AllowUserToResizeRows = false;
            dgvList.ReadOnly = true;
            dgvList.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            dgvList.AutoGenerateColumns = false;

            DataGridViewTextBoxColumn id = new DataGridViewTextBoxColumn();
            id.DisplayIndex = 0;
            id.Name = "Id";
            id.ReadOnly = true;
            id.HeaderText = "Id";
            id.DataPropertyName = "Id";

            DataGridViewTextBoxColumn name = new DataGridViewTextBoxColumn();
            name.DisplayIndex = 1;
            name.Name = "Name";
            name.ReadOnly = true;
            name.HeaderText = "Name";
            name.DataPropertyName = "Name";

            DataGridViewCheckBoxColumn enabled = new DataGridViewCheckBoxColumn();
            enabled.DisplayIndex = 2;
            enabled.Name = "Enabled";
            enabled.ReadOnly = true;
            enabled.HeaderText = "Enabled";
            enabled.DataPropertyName = "Enabled";

            dgvList.Columns.AddRange(id, name, enabled);
        }
		/*
		public CheckedListBox ()
		{
			colString = new NSString("CheckedListBox");
		}
		*/
		
		public override void SetupColumn ()
		{
			column = new DataGridViewCheckBoxColumn(colString);
			
			column.DataCell.Editable = false;
			tableView.AddColumn(column);
		}
Example #9
0
        private void button1_Click(object sender, EventArgs e)
        {
            //NavigateDirs nav = new NavigateDirs();

            nav.WalkDirectoryTree(di, FileTypes.FileExtensions.mp3);
            MusicFiles mList = nav.MusicFileList;
            BindingSource bindingSource = new BindingSource();

            foreach (MusicFile f in mList)
            {
                bindingSource.Add(f);
            }
            songGrid.AutoSize = true;
            songGrid.AutoResizeColumns();

            //Add checkbox Column
            DataGridViewColumn column = new DataGridViewCheckBoxColumn();
            column.DataPropertyName = "Copy";
            column.Name = "Copy Song";

            songGrid.Columns.Add(column);
            songGrid.Columns["songFormat"].Visible = false;
            songGrid.Columns["songLocation"].Visible = false;

            songGrid.DataSource = bindingSource;
        }
Example #10
0
        public DtrForm()
        {
            InitializeComponent();
            this.CenterToScreen();
            this.O_processCaller= new ProcessCaller(/*this*/);
            this.O_paramReader = new ParamReader();
            this.O_paramReader.readKbDatabase();
            this.dataGridView1.MultiSelect = true;
            this.dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            this.dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
            this.dataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState.True;

            DataGridViewTextBoxColumn explainColumn = new DataGridViewTextBoxColumn();
            explainColumn.HeaderText = "Info";
            //explainColumn.ReadOnly = true;
            explainColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            explainColumn.FillWeight = 75;
            this.dataGridView1.Columns.Add(explainColumn);

            this.dataGridView1.Rows.Add("First Line" + "\n" + "AAAA");

            DataGridViewCheckBoxColumn chkToFix = new DataGridViewCheckBoxColumn();
            chkToFix.HeaderText = "Fix ?";
            chkToFix.Name = "chk";
            chkToFix.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            chkToFix.FillWeight = 5;
            chkToFix.ReadOnly = false;
            this.dataGridView1.Columns.Insert(0, chkToFix);
            this.dataGridView1.Rows[0].Cells[0].Value = true;
        }
        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);
        }
Example #12
0
 private DataGridViewCheckBoxColumn CheckboxColumn(string columnName, string headerText)
 {
     DataGridViewCheckBoxColumn comboColumn = new DataGridViewCheckBoxColumn();
     comboColumn.Name = columnName;
     comboColumn.HeaderText = headerText;
     return comboColumn;
 }
Example #13
0
        public void AddCols()
        {
            DgWorkers.AutoGenerateColumns = false;
            var col1 = new DataGridViewTextBoxColumn();
            var col2 = new DataGridViewTextBoxColumn();
            var col3 = new DataGridViewTextBoxColumn();
            var col4 = new DataGridViewCheckBoxColumn();

            col1.HeaderText = "מספר עובד";
            col1.DataPropertyName = "ID";
            col1.Name = "WorkerNumber";
            DgWorkers.Columns.Add(col1);

            col2.HeaderText = "שם פרטי";
            col2.DataPropertyName = "FirstName";
            col2.Name = "FirstName";
            DgWorkers.Columns.Add(col2);

            col3.HeaderText = "שם משפחה";
            col3.DataPropertyName = "LastName";
            col3.Name = "LastName";
            DgWorkers.Columns.Add(col3);

            col4.HeaderText = "פעיל";
            col4.DataPropertyName = "Active";
            col4.Name = "Active";
            DgWorkers.Columns.Add(col4);
        }
Example #14
0
 public ItemsGridView()
 {
     //
     //
     System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
     this.AutoGenerateColumns = false;
     Items_id                    = new DataGridViewTextBoxColumn();
     Items_name                  = new System.Windows.Forms.DataGridViewTextBoxColumn();
     Items_receipt_id            = new System.Windows.Forms.DataGridViewTextBoxColumn();
     Items_price                 = new System.Windows.Forms.DataGridViewTextBoxColumn();
     Items_isReturn              = new System.Windows.Forms.DataGridViewCheckBoxColumn();
     Items_tag_printed           = new System.Windows.Forms.DataGridViewCheckBoxColumn();
     Items_receipt_date          = new System.Windows.Forms.DataGridViewTextBoxColumn();
     Items_volume                = new System.Windows.Forms.DataGridViewTextBoxColumn();
     Items_boxid                 = new System.Windows.Forms.DataGridViewTextBoxColumn();
     Items_comment               = new System.Windows.Forms.DataGridViewTextBoxColumn();
     Items_sell_price            = new System.Windows.Forms.DataGridViewTextBoxColumn();
     Items_sell_date             = new System.Windows.Forms.DataGridViewTextBoxColumn();
     dataGridViewCellStyle1.Font = new System.Drawing.Font("Meiryo UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
     this.CellBeginEdit         += new DataGridViewCellCancelEventHandler(ItemsGridView_CellBeginEdit);
     this.CellEndEdit           += new DataGridViewCellEventHandler(ItemsGridView_CellEndEdit);
     this.RowLeave              += new DataGridViewCellEventHandler(ItemsGridView_RowLeave);
     this.RowEnter              += new DataGridViewCellEventHandler(ItemsGridView_RowEnter);
     this.Leave                 += new EventHandler(ItemsGridView_Leave);
     this.UserDeletingRow       += new DataGridViewRowCancelEventHandler(ItemsGridView_UserDeletingRow);
     this.UserDeletedRow        += new DataGridViewRowEventHandler(ItemsGridView_UserDeletedRow);
 }
        internal NewSportsFestivalGUI(NewSportsFestivalController controller)
        {
            InitializeComponent();

            this.StyleManager = metroStyleManager;

            DataGridViewCheckBoxColumn checkboxColumn = new DataGridViewCheckBoxColumn();
            checkboxColumn.HeaderText = "";
            checkboxColumn.Name = competitionGridColumn0Name;
            checkboxColumn.Width = 50;

            DataGridViewTextBoxColumn competitionIdColumn = new DataGridViewTextBoxColumn();
            competitionIdColumn.HeaderText = "Wettkampf-ID";
            competitionIdColumn.Name = competitionGridColumn1Name;
            competitionIdColumn.Visible = false;

            DataGridViewTextBoxColumn competitionNameColumn = new DataGridViewTextBoxColumn();
            competitionNameColumn.HeaderText = "Wettkampf";
            competitionNameColumn.Name = competitionGridColumn2Name;
            competitionNameColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            competitionNameColumn.ReadOnly = true;

            competitionGrid.Columns.Add(checkboxColumn);
            competitionGrid.Columns.Add(competitionIdColumn);
            competitionGrid.Columns.Add(competitionNameColumn);
        }
        private DataSet numProvincia; // usado en funcion TComboBoxCiudades_Click

        #endregion Fields

        #region Constructors

        public GestionPersonalBuscar()
        {
            InitializeComponent();

            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
            }

            TDataGridViewPersonal.Columns.Add(boton);
            TDataGridViewPersonal.Columns.Add(buttons);
        }
        public void CargarTabla()
        {
            // Format DataGridView
            
            this.dataGridView1.AllowUserToAddRows = false;
            this.dataGridView1.BackgroundColor = this.BackColor;

            this.dataGridView1.RowHeadersWidth = 75;
            
            String [] Semana = {"Lunes", 
                                "Martes", 
                                "Miercoles", 
                                "Jueves", 
                                "Viernes", 
                                "Sabado"
                               };

            // Add columns to DataGridView

            foreach (String item in Semana)
            {
                DataGridViewCheckBoxColumn checkColumn = new DataGridViewCheckBoxColumn();
                checkColumn.Name = "Columna_" + item;
                checkColumn.HeaderText = item;
                checkColumn.Width = 75;
                checkColumn.ReadOnly = true;
                checkColumn.FillWeight = 10; //if the datagridview is resized (on form resize) the checkbox won't take up too much; value is relative to the other columns' fill values
                dataGridView1.Columns.Add(checkColumn);
            }

            // Add rows to DataGridView
            for (int i = 7; i <= 32; i++)
            {
                TimeSpan t = TimeSpan.FromSeconds(25200 + ((i - 7)* 1800));
                dataGridView1.Rows.Add();
                dataGridView1.Rows[i - 7].HeaderCell.Value = t.ToString().Substring(0, 5) ;
            }

            // Sabados no se trabaja hasta las 10
            for (int i = 0; i < 6; i++)
            {
                DataGridViewTextBoxCell TextBoxCell = new DataGridViewTextBoxCell();
                dataGridView1[5, i] = TextBoxCell;
                dataGridView1[5, i].Value = "";
                dataGridView1[5, i].Style.BackColor = Color.Black;
                dataGridView1[5, i].ReadOnly = true;
            }

            // Sabados no se trabaja desde las 5
            for (int i = 16; i <= 25; i++)
            {
                DataGridViewTextBoxCell TextBoxCell = new DataGridViewTextBoxCell();
                dataGridView1[5, i] = TextBoxCell;
                dataGridView1[5, i].Value = "";
                dataGridView1[5, i].Style.BackColor = Color.Black;
                dataGridView1[5, i].ReadOnly = true;
                
            }
            
        }
 private void CreateCell(string[] rows, string[] columns)
 {
     DataGridViewColumnCollection matrixColumns = matrixDataGridView.Columns;
     matrixColumns.Add("nullColumn", "Traceability Matrix");
     for (int j = 0; j < columns.Length; j++)
     {
         DataGridViewCheckBoxColumn checkColumn = new DataGridViewCheckBoxColumn();
         checkColumn.Name = "testColumn";
         checkColumn.HeaderText = columns[j];
         checkColumn.TrueValue = true;
         checkColumn.FalseValue = false;
         checkColumn.FillWeight = 10;
         matrixColumns.Add(checkColumn);
     }
     DataGridViewRowCollection matrixRows = matrixDataGridView.Rows;
     for (int i = 0; i < rows.Length; i++)
     {
         matrixRows.Add(rows[i]);
     }
     matrixDataGridView.Columns[0].Frozen = true;
     matrixDataGridView.Columns[0].ReadOnly = true;
     bool flag = false;
     
     for (int i = 0; i < rows.Length; i++)
     {
         for (int j = 0; j < columns.Length; j++)
         {
             DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)matrixDataGridView.Rows[i].Cells[1 + j];
             chk.Selected = flag;
             flag = !flag;
         }
     }
 }
        private bool TryWriteFileIntoTable(StreamReader reader)
        {
            document = OrderFileParser.ParseOrderFile(reader, out prologue, out epilogue);

            if (document.Count == 0)
                return false;

            tableOrder.Clear();

            foreach (PaymentRecord record in document)
            {
                tableOrder.Rows.Add(record.documentDate.ToString("dd.MM.yyyy"), record.documentNumber, 
                    record.correspondentCode, record.correspondentAccount, record.ratingCredit);
            }

            gridOrder.DataSource = null;
            gridOrder.Columns.Clear();
            gridOrder.DataSource = tableOrder;
            gridOrder.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            DataGridViewCheckBoxColumn column;

            foreach (DataGridViewColumn c in gridOrder.Columns)
                c.ReadOnly = true;

            foreach (String filial in OrderFileGenerator.filialNames)
            {
                column = new DataGridViewCheckBoxColumn();
                column.HeaderText = filial;
                column.Name = filial;
                column.HeaderCell.Style.ForeColor = Color.SlateBlue;
                column.HeaderCell.Style.Font = new Font(gridOrder.Font, FontStyle.Bold);
                gridOrder.Columns.Add(column);
            }
            return true;
        }
Example #20
0
        //onload fill datagrid
        private void adviserForm_Load(object sender, EventArgs e)
        {
            DataGridViewColumn column = new DataGridViewTextBoxColumn();
            // Initialize and add a check box column.

            column = new DataGridViewImageColumn();
            //   column.Image
            column.DataPropertyName = "pictureArrByte";
            column.Width = 80;

            column.Name = "picture";
            column.ReadOnly = false;
            dataGridView.Columns.Add(column);

            column = new DataGridViewTextBoxColumn();
            column.DataPropertyName = "playerId";
            column.Name = "Id";
            dataGridView.Columns.Add(column);

            column = new DataGridViewTextBoxColumn();
            column.DataPropertyName = "firstName";
            column.Name = "First Name";
            dataGridView.Columns.Add(column);

            column = new DataGridViewTextBoxColumn();
            column.DataPropertyName = "lastName";
            column.Name = "Last Name";
            dataGridView.Columns.Add(column);

            // Initialize and add a check box column.
            DataGridViewCheckBoxColumn columnCheckBox = new DataGridViewCheckBoxColumn();
            columnCheckBox.DataPropertyName = "Action";
            columnCheckBox.Name = "Action";
            columnCheckBox.ReadOnly = false;
            dataGridView.Columns.Add(columnCheckBox);

            //Fill data to form
            Players[] list = server.getAdvisors(playerId);
            dataGridView.AutoGenerateColumns = false;
            dataGridView.AutoSize = false;
            foreach (Players player in list)
            {
                if (player.pictureArrByte != null)
                {

                    Rectangle compressionRectangle = new Rectangle(60, 60,
                     player.pictureArrByte.Width / 2, player.pictureArrByte.Height / 2);
                    using (Graphics g = Graphics.FromImage(player.pictureArrByte))
                        g.DrawImage(player.pictureArrByte, compressionRectangle);
                }

            }
            dataGridView.DataSource = list;
            //set the heigt for picture colum
            foreach (DataGridViewRow row in dataGridView.Rows)
            {
                row.Height = 75;
            }

        }
Example #21
0
        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);
        }
 private void SetupDataGridViewColumns()
 {
     using (var col = new DataGridViewTextBoxColumn())
     {
         col.DataPropertyName = "Name";
         col.HeaderText = "Name";
         dgvNameEntries.Columns.Add(col);
         col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
     }
     using (var col = new DataGridViewComboBoxColumn())
     {
         col.DataPropertyName = "NamePosition";
         col.HeaderText = "Name Position";
         col.DataSource = Enum.GetValues(typeof(NamePosition));
         col.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
         dgvNameEntries.Columns.Add(col);
     }
     using (var col = new DataGridViewCheckBoxColumn())
     {
         col.DataPropertyName = "IsFemale";
         col.HeaderText = "Is Female";
         col.FalseValue = false;
         col.TrueValue = true;
         col.AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader;
         dgvNameEntries.Columns.Add(col);
     }
 }
        //--selected index change exant for the test name combobox-->
        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {

            DataRowView dr=(DataRowView)comboBox2.SelectedItem;
            test_code=Convert.ToString(dr["test_code"]);

            dataGridView1.Columns.Clear();
            DataGridViewCheckBoxColumn ob1 = new DataGridViewCheckBoxColumn();
            dataGridView1.Columns.Add("sub_code", "SUBJECT CODE");
            dataGridView1.Columns.Add("sub_name", "SUBJECT NAME");
            dataGridView1.Columns.Add(ob1);
            dataGridView1.Columns[2].HeaderText = "QUESTION PRESENT";
            dataGridView1.Columns[2].Name = "is_present";
            dataGridView1.RowHeadersVisible = false;
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            dataGridView1.Columns[0].SortMode = DataGridViewColumnSortMode.Programmatic;
            dataGridView1.Columns[1].SortMode = DataGridViewColumnSortMode.Programmatic;
            dataGridView1.Columns[2].ReadOnly = true;



            s = "select sub_code,sub_name from subject_master where exam_code='" + exam_code + "'";
            DataSet ds = ob.fill_data_set(s);
            dataGridView1.Rows.Add(ds.Tables[0].Rows.Count);
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {   dataGridView1.Rows[i].Cells["sub_code"].Value = ds.Tables[0].Rows[i]["sub_code"];
                dataGridView1.Rows[i].Cells["sub_name"].Value = ds.Tables[0].Rows[i]["sub_name"];
                s = null;
                s = "select iif ( count(*),1,0)  from questions_master where exam_code='" + exam_code + "' and test_code='" + test_code + "' and sub_code='" + Convert.ToString(ds.Tables[0].Rows[i]["sub_code"]) + "';";
                dataGridView1.Rows[i].Cells["is_present"].Value = Convert.ToInt32(ob.execute_scalar(s));
            }
            

        }
Example #24
0
        private void init()
        {
            this.dgv = new DataGridView();
            this.dgv.Dock = DockStyle.Fill;
            this.dgv.BorderStyle = BorderStyle.None;
            this.dgv.BackgroundColor = SystemColors.Window;
            this.dgv.Font = PluginBase.Settings.DefaultFont;
            this.dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dgv.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.None;
            this.dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            this.dgv.CellBorderStyle = DataGridViewCellBorderStyle.Single;
            this.dgv.EnableHeadersVisualStyles = true;
            this.dgv.RowHeadersVisible = false;

            DataGridViewCellStyle viewStyle = new DataGridViewCellStyle();
            viewStyle.Padding = new Padding(1);
            this.dgv.ColumnHeadersDefaultCellStyle = viewStyle;

            this.ColumnBreakPointEnable = new DataGridViewCheckBoxColumn();
            this.ColumnBreakPointFilePath = new DataGridViewTextBoxColumn();
            this.ColumnBreakPointFileName = new DataGridViewTextBoxColumn();
            this.ColumnBreakPointLine = new DataGridViewTextBoxColumn();
            this.ColumnBreakPointExp = new DataGridViewTextBoxColumn();

            this.ColumnBreakPointEnable.HeaderText = TextHelper.GetString("Label.Enable");
            this.ColumnBreakPointEnable.Name = "Enable";
            this.ColumnBreakPointEnable.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
            this.ColumnBreakPointEnable.Width = 70;

            this.ColumnBreakPointFilePath.HeaderText = TextHelper.GetString("Label.Path");
            this.ColumnBreakPointFilePath.Name = "FilePath";
            this.ColumnBreakPointFilePath.ReadOnly = true;

            this.ColumnBreakPointFileName.HeaderText = TextHelper.GetString("Label.File");
            this.ColumnBreakPointFileName.Name = "FileName";
            this.ColumnBreakPointFileName.ReadOnly = true;

            this.ColumnBreakPointLine.HeaderText = TextHelper.GetString("Label.Line");
            this.ColumnBreakPointLine.Name = "Line";
            this.ColumnBreakPointLine.ReadOnly = true;

            this.ColumnBreakPointExp.HeaderText = TextHelper.GetString("Label.Exp");
            this.ColumnBreakPointExp.Name = "Exp";

            this.dgv.AllowUserToAddRows = false;
            this.dgv.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
                this.ColumnBreakPointEnable,
                this.ColumnBreakPointFilePath,
                this.ColumnBreakPointFileName,
                this.ColumnBreakPointLine,
                this.ColumnBreakPointExp});

            defaultColor = dgv.Rows[dgv.Rows.Add()].DefaultCellStyle.BackColor;
            dgv.Rows.Clear();

            this.dgv.CellEndEdit += new DataGridViewCellEventHandler(dgv_CellEndEdit);
            this.dgv.CellMouseUp += new DataGridViewCellMouseEventHandler(dgv_CellMouseUp);
            this.dgv.CellDoubleClick += new DataGridViewCellEventHandler(dgv_CellDoubleClick);
        }
Example #25
0
        private void initDataGrid() {
            DataGridViewCheckBoxColumn enableColumn = new DataGridViewCheckBoxColumn();
            enableColumn.Name = "Enable";
            enableColumn.HeaderText = Resources.Enable;
            enableColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            enableColumn.MinimumWidth = 50;

            DataGridViewTextBoxColumn behaviorFileColumn = new DataGridViewTextBoxColumn();
            behaviorFileColumn.Name = "BehaviorFilename";
            behaviorFileColumn.HeaderText = Resources.BehaviorFilename;
            behaviorFileColumn.ReadOnly = true;
            behaviorFileColumn.MinimumWidth = 180;

            DataGridViewTextBoxColumn nodeTypeColumn = new DataGridViewTextBoxColumn();
            nodeTypeColumn.Name = "NodeType";
            nodeTypeColumn.HeaderText = Resources.NodeType;
            nodeTypeColumn.ReadOnly = true;
            nodeTypeColumn.MinimumWidth = 120;

            DataGridViewTextBoxColumn nodeIdColumn = new DataGridViewTextBoxColumn();
            nodeIdColumn.Name = "NodeId";
            nodeIdColumn.HeaderText = Resources.NodeId;
            nodeIdColumn.ReadOnly = true;
            nodeIdColumn.MinimumWidth = 100;

            DataGridViewTextBoxColumn actionNameColumn = new DataGridViewTextBoxColumn();
            actionNameColumn.Name = "ActionName";
            actionNameColumn.HeaderText = Resources.ActionName;
            actionNameColumn.ReadOnly = true;
            actionNameColumn.MinimumWidth = 100;

            DataGridViewComboBoxColumn actionResultColumn = new DataGridViewComboBoxColumn();
            actionResultColumn.Name = "ActionResult";
            actionResultColumn.HeaderText = Resources.ActionResult;
            actionResultColumn.MinimumWidth = 100;
            actionResultColumn.Items.Add(DebugDataPool.Action.kResultAll);
            actionResultColumn.Items.Add(DebugDataPool.Action.kResultSuccess);
            actionResultColumn.Items.Add(DebugDataPool.Action.kResultFailure);

            DataGridViewTextBoxColumn hitCountColumn = new DataGridViewTextBoxColumn();
            hitCountColumn.Name = "HitCount";
            hitCountColumn.HeaderText = Resources.HitCount;
            hitCountColumn.MinimumWidth = 100;

            DataGridViewTextBoxColumn dummyColumn = new DataGridViewTextBoxColumn();
            dummyColumn.Name = "Dummy";
            dummyColumn.HeaderText = "";
            dummyColumn.ReadOnly = true;
            dummyColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

            dataGridView.Columns.Add(enableColumn);
            dataGridView.Columns.Add(behaviorFileColumn);
            dataGridView.Columns.Add(nodeTypeColumn);
            dataGridView.Columns.Add(nodeIdColumn);
            dataGridView.Columns.Add(actionNameColumn);
            dataGridView.Columns.Add(actionResultColumn);
            dataGridView.Columns.Add(hitCountColumn);
            dataGridView.Columns.Add(dummyColumn);
        }
        public void crearGrilla()
        {
            dgAmbulatorios.Columns.Clear();
            dgAmbulatorios.AutoGenerateColumns = false;
            dgAmbulatorios.RowHeadersVisible = false;

            DataGridViewCheckBoxColumn clm_checkbox = new DataGridViewCheckBoxColumn();
            clm_checkbox.Width = 50;
            clm_checkbox.ReadOnly = false;
            clm_checkbox.DataPropertyName = "Existe";
            clm_checkbox.HeaderText = "";
            dgAmbulatorios.Columns.Add(clm_checkbox);

            DataGridViewTextBoxColumn clm_Medico = new DataGridViewTextBoxColumn();
            clm_Medico.Width = 260;
            clm_Medico.ReadOnly = true;
            clm_Medico.DataPropertyName = "Planilla_medico_secundario_nombre";
            clm_Medico.HeaderText = "Profesional";
            dgAmbulatorios.Columns.Add(clm_Medico);

            DataGridViewTextBoxColumn clm_Beneficio = new DataGridViewTextBoxColumn();
            clm_Beneficio.Width = 160;
            clm_Beneficio.ReadOnly = true;
            clm_Beneficio.DataPropertyName = "Planilla_beneficio";
            clm_Beneficio.HeaderText = "Beneficio";
            dgAmbulatorios.Columns.Add(clm_Beneficio);

            DataGridViewTextBoxColumn clm_Practica = new DataGridViewTextBoxColumn();
            clm_Practica.Width = 120;
            clm_Practica.ReadOnly = true;
            clm_Practica.DataPropertyName = "Planilla_practica";
            clm_Practica.HeaderText = "Práctica";
            dgAmbulatorios.Columns.Add(clm_Practica);

            DataGridViewTextBoxColumn clm_Fecha = new DataGridViewTextBoxColumn();
            clm_Fecha.Width = 100;
            clm_Fecha.ReadOnly = true;
            clm_Fecha.DataPropertyName = "Planilla_fecha";
            clm_Fecha.HeaderText = "Fecha";
            dgAmbulatorios.Columns.Add(clm_Fecha);

            DataGridViewTextBoxColumn clm_Hora = new DataGridViewTextBoxColumn();
            clm_Hora.Width = 80;
            clm_Hora.ReadOnly = true;
            clm_Hora.DataPropertyName = "Planilla_hora";
            clm_Hora.HeaderText = "Hora";
            dgAmbulatorios.Columns.Add(clm_Hora);

            dgAmbulatorios.DataSource = unaPlanilla.tablaPlanilla;
            dgAmbulatorios.AllowUserToAddRows = false;

            DataGridViewCellStyle miestilo = new DataGridViewCellStyle();
            miestilo.Font = new Font("Franklin Gothic Book", 11);

            dgAmbulatorios.EnableHeadersVisualStyles = false;
            dgAmbulatorios.ColumnHeadersDefaultCellStyle = miestilo;
            dgAmbulatorios.ColumnHeadersDefaultCellStyle.ForeColor = Color.DarkCyan;
            dgAmbulatorios.ColumnHeadersDefaultCellStyle.BackColor = Color.Gainsboro;
        }
Example #27
0
        public TagQuantForm()
        {
            InitializeComponent();
            this.Text = "Tag Quant v" + Assembly.GetExecutingAssembly().GetName().Version.ToString();

            dataGridView2.AutoGenerateColumns = false;
            dataGridView2.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;

            DataGridViewCheckBoxColumn useColumn = new DataGridViewCheckBoxColumn();
            useColumn.DataPropertyName = "IsUsed";
            useColumn.HeaderText = "Use";
            useColumn.Frozen = true;
            useColumn.ContextMenuStrip = new ContextMenuStrip();
            useColumn.ContextMenuStrip.Items.Add("Select All").Click += CheckBoxColumnSelectAll;
            useColumn.ContextMenuStrip.Items.Add("Deselect All").Click += CheckBoxColumnDeselectAll;
            dataGridView2.Columns.Add(useColumn);

            DataGridViewTextBoxColumn nameColumn = new DataGridViewTextBoxColumn();
            nameColumn.DataPropertyName = "TagName";
            nameColumn.HeaderText = "Tag";
            nameColumn.Frozen = true;
            nameColumn.ReadOnly = true;
            dataGridView2.Columns.Add(nameColumn);

            DataGridViewTextBoxColumn sampleColumn = new DataGridViewTextBoxColumn();
            sampleColumn.DataPropertyName = "SampleName";
            sampleColumn.HeaderText = "Sample Name";
            dataGridView2.Columns.Add(sampleColumn);

            DataGridViewTextBoxColumn mzColumn = new DataGridViewTextBoxColumn();
            mzColumn.DataPropertyName = "MassCAD";
            mzColumn.HeaderText = "m/z (CAD)";
            dataGridView2.Columns.Add(mzColumn);

            DataGridViewTextBoxColumn m2Column = new DataGridViewTextBoxColumn();
            m2Column.DataPropertyName = "M2";
            m2Column.HeaderText = "-2";
            dataGridView2.Columns.Add(m2Column);

            DataGridViewTextBoxColumn m1Column = new DataGridViewTextBoxColumn();
            m1Column.DataPropertyName = "M1";
            m1Column.HeaderText = "-1";
            dataGridView2.Columns.Add(m1Column);

            DataGridViewTextBoxColumn p1Column = new DataGridViewTextBoxColumn();
            p1Column.DataPropertyName = "P1";
            p1Column.HeaderText = "+1";
            dataGridView2.Columns.Add(p1Column);

            DataGridViewTextBoxColumn p2Column = new DataGridViewTextBoxColumn();
            p2Column.DataPropertyName = "P2";
            p2Column.HeaderText = "+2";
            dataGridView2.Columns.Add(p2Column);

            radioButton2.Checked = true;
            //allTags = new BindingList<TagInformation>(tmtTags);

            dataGridView2.DataSource = allTags;
        }
Example #28
0
        public ArrayList UpdateSearchResult(StructuredQueue oQueues)
        {
            ArrayList arrayTemp = new ArrayList();
            DataGridViewCheckBoxColumn column = new DataGridViewCheckBoxColumn();
            {
                column.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
                column.FlatStyle = FlatStyle.Standard; column.ThreeState = true;
                column.CellTemplate = new DataGridViewCheckBoxCell();
                column.CellTemplate.Style.BackColor = Color.Beige;
            }
            try
            {
                Object[] cellValues = null;

                foreach (QueueInfos Messages in oQueues.Message)
                {
                    Application.DoEvents();
                    bool InfoFlag = false;
                    if ((chkqueuname.Checked) && (Regex.IsMatch(oQueues.sQueueName, txtSearch.Text.ToString(),RegexOptions.IgnoreCase)))
                        InfoFlag = true;

                    if ((chkLabel.Checked) && (Regex.IsMatch(Messages.Label, txtSearch.Text.ToString(), RegexOptions.IgnoreCase)))
                        InfoFlag = true;

                    if ((chkBody.Checked) && (Regex.IsMatch(Messages.Body, txtSearch.Text.ToString(), RegexOptions.IgnoreCase)))
                        InfoFlag = true;

                    if (Messages.Transact == 2)
                        Messages.Transaction = "True";
                    else if (Messages.Transact == 3)
                        Messages.Transaction = "False";
                    else if (Messages.Transact == 1)
                        Messages.Transaction = "Remote";
                    Messages.Path = oQueues.sPath;
                    Messages.QueueName = oQueues.sQueueName;
                    if (InfoFlag)
                    {
                        cellValues = new Object[]
                                {false,
                                (Convert.ToInt32(dgSearchresult.Rows.Count) +1) ,
                                Messages.Path,
                                Messages.QueueName,
                                Messages.Label,
                                Messages.Body,
                                Messages.Priority,
                                Messages.ID,
                                Messages.Transaction,
                                Messages.SentTime

                                };

                        dgSearchresult.Rows.Add(cellValues);
                        arrayTemp.Add(Messages);
                    }
                }
            }
            catch { }
            return arrayTemp;
        }
Example #29
0
 public static DataGridViewCheckBoxColumn ReturnDataGridCBColumn(string name)
 {
     DataGridViewCheckBoxColumn column = new DataGridViewCheckBoxColumn();
     column.Name = name;
     column.HeaderText = name;
     column.DataPropertyName = name;
     return column;
 }
Example #30
0
        public JpegViewer(string[] _jpgFiles, string jpgFile = "")
        {
            InitializeComponent();

            this.WindowState = FormWindowState.Maximized;//Maximize form

            #region initialize dgv
            //Add ImageColumn
            DataGridViewImageColumn imgColumn = new DataGridViewImageColumn();
            imgColumn.Name = "Image";
            imgColumn.ImageLayout = DataGridViewImageCellLayout.Zoom;//イメージを縦横の比率を維持して拡大、縮小表示する
            imgColumn.Description = "イメージ"; //イメージの説明。セルをクリップボードにコピーした時に使用される
            dgv.Columns.Add(imgColumn);//DataGridViewに追加する
            dgv.Columns["Image"].Width = 120;
            dgv.RowTemplate.Height = 90;

            //Add CheckBoxColumn
            DataGridViewCheckBoxColumn cbColumn = new DataGridViewCheckBoxColumn();
            cbColumn.Name = "cbColumn";
            dgv.Columns.Add(cbColumn);
            cbColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;

            //Add TextBoxColumn
            DataGridViewTextBoxColumn tbColumn = new DataGridViewTextBoxColumn();
            tbColumn.Name = "tbColumn";
            tbColumn.ReadOnly = true;
            dgv.Columns.Add(tbColumn);
            tbColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;

            dgv.RowHeadersVisible = false;//Make selector invisible
            dgv.ColumnHeadersVisible = false;//Make column header invisible
            dgv.AllowUserToAddRows = false;
            dgv.AllowUserToResizeColumns = false;
            dgv.AllowUserToResizeRows = false;
            #endregion

            #region dgv image procedure
            jpgFiles.AddRange(_jpgFiles);
            jpgFiles.Sort();

            for (int i = 0; i < jpgFiles.Count; i++)
            {
                try
                {
                    dgv.Rows.Add();
                    dgv["Image", i].Value = new Bitmap(jpgFiles[i].ToString());
                }
                catch (ArgumentOutOfRangeException)
                { MessageBox.Show("[ArgumentOutOfRangeException]" + Properties.Resources.HasOccurred, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
            }
            #endregion

            #region pictureBox
            pbMain.SizeMode = PictureBoxSizeMode.Zoom;
            selectedJpgFile = jpgFile;
            #endregion
        }
        //---function for filling up the datagridview-->
        public void  fill_grid()
        {
            row = 0;
            textBox2.Text = null;
            checkBox1.Checked = false;
            checkBox2.Checked = false;
            class_Application.flag = 1;
            ds = new DataSet();

            dataGridView1.Columns.Clear();
            dataGridView1.Rows.Clear();
            dataGridView1.Columns.Add("Examcode", "Exam Code");
            dataGridView1.Columns.Add("ExamName", "Exam Name");
            DataGridViewCheckBoxColumn chk = new DataGridViewCheckBoxColumn();
            dataGridView1.Columns.Add(chk);
            dataGridView1.Columns[2].Name = "Skip";
            dataGridView1.Columns[2].HeaderText = "SKIP";
            DataGridViewCheckBoxColumn chk2 = new DataGridViewCheckBoxColumn();
            dataGridView1.Columns.Add(chk2);
            dataGridView1.Columns[3].Name = "Negetive";
            dataGridView1.Columns[3].HeaderText = "NEGETIVE";

                                   
                s = null;
                s = "select exam_code,exam_name,can_skip,negetive_marking from exam_master;";
                //--loadingthe datagrid view with the dataset--->
                ds = ob.fill_data_set(s);

                int i = 0;

                if (ds.Tables[0].Rows.Count > 0)
                {
                    dataGridView1.Rows.Add(ds.Tables[0].Rows.Count);
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        dataGridView1.Rows[i].Cells["ExamCode"].Value = dr["exam_code"];
                        dataGridView1.Rows[i].Cells["ExamName"].Value = dr["exam_name"];
                        dataGridView1.Rows[i].Cells["Skip"].Value = Convert.ToInt32(dr["can_skip"]);
                        dataGridView1.Rows[i].Cells["Negetive"].Value = Convert.ToInt32(dr["negetive_marking"]);
                        i++;
                    }

                   
                }
                //---assigning the default cell fill type property for the datagridveiw1--->
                dataGridView1.RowHeadersVisible = false;
                dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
                dataGridView1.Columns[0].SortMode = DataGridViewColumnSortMode.Programmatic;
                dataGridView1.Columns[1].SortMode = DataGridViewColumnSortMode.Programmatic;
                dataGridView1.Columns[2].SortMode = DataGridViewColumnSortMode.Programmatic;
                dataGridView1.Columns[3].SortMode = DataGridViewColumnSortMode.Programmatic;
                dataGridView1.Columns[0].ReadOnly = true;
                dataGridView1.Columns[1].ReadOnly = true;
                dataGridView1.Columns[2].ReadOnly = true;
                dataGridView1.Columns[3].ReadOnly = true;
          
          }
        public void CheckBoxTest()
        {
            SWF.DataGridViewCheckBoxColumn column = new SWF.DataGridViewCheckBoxColumn();
            column.HeaderText = "CheckBox Column";

            SWF.DataGridViewCheckBoxCell cell = new SWF.DataGridViewCheckBoxCell();
            cell.Value = false;

            SWF.DataGridViewCheckBoxCell cell1 = new SWF.DataGridViewCheckBoxCell();
            cell1.Value = false;

            ColumnCellTest(column, cell, false, cell1);
        }
Example #33
0
        private void buttonX1_Click(object sender, EventArgs e)
        {
            buttonX2.Enabled = false;
            if (string.IsNullOrEmpty(textBoxX1.Text))
            {
                MessageBox.Show("关键词不能为空");
                return;
            }
            this.dataGridViewX1.Columns.Clear();
            var db1 = new Model1();

            cnkis = db1.Cnkis.Where(o => o.Category == comboBoxEx1.Text && o.KeyWord.Contains(textBoxX1.Text)).ToList();
            if (cnkis == null || cnkis.Count == 0)
            {
                MessageBox.Show("没找到记录");
                dataGridViewX1.DataSource = new DataTable();
                return;
            }

            System.Windows.Forms.DataGridViewCheckBoxColumn Column1;
            Column1            = new System.Windows.Forms.DataGridViewCheckBoxColumn();
            Column1.HeaderText = "选择";
            Column1.Name       = "Select";

            this.dataGridViewX1.Columns.Add(Column1);
            var searchedDataTable = standardTable.Clone();

            foreach (var dataitem in cnkis.Select(o => new
            {
                o.Title,
                o.Author,
                o.JournalName,
                o.PublishDate,
                o.DownloadedCount
            }).ToList())
            {
                var newrow = searchedDataTable.NewRow();
                newrow["篇名"]  = dataitem.Title;
                newrow["作者"]  = dataitem.Author;
                newrow["刊名"]  = dataitem.JournalName;
                newrow["年期"]  = dataitem.PublishDate;
                newrow["下载数"] = dataitem.DownloadedCount;
                searchedDataTable.Rows.Add(newrow);
            }

            dataGridViewX1.DataSource = searchedDataTable;
            buttonX2.Enabled          = searchedDataTable.Rows.Count > 0;
        }
Example #34
0
        private void loadPage()
        {
            CrossThreadUtility.InvokeControlAction <DataGridView>(dg, dataGrid =>
            {
                var m_pagedCandidates = m_filteredPositions.Skip(m_CurrentPage * Properties.Settings.Default.PageSize)
                                        .Take(Properties.Settings.Default.PageSize);

                m_mainGridBindingSource            = new BindingSource();
                m_mainGridBindingSource.DataSource = new List <Position>(m_pagedCandidates);

                dataGrid.Columns.Clear();
                dataGrid.DataSource = m_mainGridBindingSource;
                if (m_filteredPositions.Count() > 0 && dataGrid.Columns.Count > 0)
                {
                    dataGrid.Columns[0].Visible  = false;
                    dataGrid.Columns[10].Visible = false;
                    dataGrid.Columns[11].Visible = false;
                }

                if (m_openMode == FormOpenMode.SearchAndSelect)
                {
                    dataGrid.ReadOnly = false;

                    for (int i = 0; i < dataGrid.ColumnCount; i++)
                    {
                        dataGrid.Columns[i].ReadOnly = true;
                    }

                    var col          = new System.Windows.Forms.DataGridViewCheckBoxColumn();
                    col.Width        = 30;
                    col.Frozen       = true;
                    col.DividerWidth = 3;
                    col.MinimumWidth = 30;
                    col.ReadOnly     = false;

                    dataGrid.Columns.Insert(0, col);
                }
                else
                {
                    dataGrid.ReadOnly = true;
                }
            });

            // Show Status
            CrossThreadUtility.InvokeControlAction <Label>(lblStatus, label => label.Text    = (m_CurrentPage + (m_TotalRecords > 0 ? 1 : 0)).ToString() + " / " + m_TotalPages.ToString());
            CrossThreadUtility.InvokeControlAction <Panel>(panelWait, panel => panel.Visible = false);
        }
Example #35
0
        } //LoadMissingDivs()

        private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
        {
            // Local Variables
            String mySql;
            String myDate;

            //dg_Dividends.Rows.Clear();
            dg_Dividends.Update();
            myDate = dateTimePicker1.Value.ToString("dd-MMM-yyyy");
            mySql  = "Select	BBG_Ticker, Div_Adjusted as [DPS $], Div_Crncy as Currency, Franking, ExDate as [Ex Date], PayableDate as [Payable Date], ID_BB_UNIQUE, 'N' as Changed, ExDate as [Orig_ExDate], CapitalReturn, WithholdingTaxRate as [Withholding Tax Rate]"+
                     "From	Dividends "+
                     "Where	ExDate >= '" + myDate + "' " +
                     "Order by ExDate, BBG_Ticker ";

            dt_Dividends            = SystemLibrary.SQLSelectToDataTable(mySql);
            dg_Dividends.DataSource = dt_Dividends;
            ParentForm1.SetFormatColumn(dg_Dividends, @"DPS $", Color.Empty, Color.LightCyan, "N8", "0");
            ParentForm1.SetFormatColumn(dg_Dividends, "Franking", Color.Empty, Color.Empty, "0.0%", "0");
            ParentForm1.SetFormatColumn(dg_Dividends, "Withholding Tax Rate", Color.Empty, Color.Empty, "0.000%", "0.000%");
            dg_Dividends.Columns["BBG_Ticker"].HeaderText                = "Ticker";
            dg_Dividends.Columns["Ex Date"].DefaultCellStyle.Format      = "dd-MMM-yy"; // M = dd-Mon, D = Short Date/Time, F = Long Date/Time
            dg_Dividends.Columns["Ex Date"].DefaultCellStyle.ForeColor   = Color.Blue;
            dg_Dividends.Columns["Payable Date"].DefaultCellStyle.Format = "dd-MMM-yy"; // M = dd-Mon, D = Short Date/Time, F = Long Date/Time
            dg_Dividends.Columns["CapitalReturn"].Visible                = false;

            if (!dg_Dividends.Columns.Contains("IsCapitalReturn"))
            {
                System.Windows.Forms.DataGridViewCheckBoxColumn IsCapitalReturn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
                IsCapitalReturn.DataPropertyName = "CapitalReturn";
                IsCapitalReturn.FalseValue       = "N";
                IsCapitalReturn.HeaderText       = "IsCapitalReturn";
                IsCapitalReturn.Name             = "IsCapitalReturn";
                IsCapitalReturn.Resizable        = System.Windows.Forms.DataGridViewTriState.True;
                IsCapitalReturn.SortMode         = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
                IsCapitalReturn.TrueValue        = "Y";
                IsCapitalReturn.Width            = 67;
                dg_Dividends.Columns.Add(IsCapitalReturn);
            }
            dg_Dividends.Columns["DPS $"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dg_Dividends.Columns["Changed"].Visible     = false;
            dg_Dividends.Columns["Orig_ExDate"].Visible = false;
        } //dateTimePicker1_ValueChanged()
Example #36
0
        } //ForwardDividends_FormClosed()

        private void LoadMissingDivs()
        {
            // Local Variables
            String mySql = "Exec sp_LoadMissingDivs";

            dt_Prime_Divs = SystemLibrary.SQLSelectToDataTable(mySql);

            tb_TotalAmount.Text = SystemLibrary.ToDecimal(dt_Prime_Divs.Compute("Sum(Amount)", "")).ToString("$#,###.00");

            if (dt_Prime_Divs.Rows.Count > 0)
            {
                // Force the Prime file to be reprocessed to see if this clears the problem.
                // As this takes a few seconds, better to call mySQL twice on occasions where there are problems, rather than each time we enter divs screen
                DataRow[] dr = dt_Prime_Divs.Select("CustodianName='Merrill Lynch'");
                if (dr.Length > 0)
                {
                    SystemLibrary.SQLExecute("Exec sp_ML_Process_File '', 'ML_E239' ");
                }

                dr = dt_Prime_Divs.Select("CustodianName='SCOTIA'");
                if (dr.Length > 0)
                {
                    SystemLibrary.SQLExecute("Exec sp_Scotia_Process_File '', 'SCOTIA_CASHSTMNT'");
                    SystemLibrary.SQLExecute("Exec sp_Scotia_Process_File '', 'SCOTIA_ACCTHIST'");
                }

                dt_Prime_Divs = SystemLibrary.SQLSelectToDataTable(mySql);
            }

            dg_MissingDivs.DataSource = dt_Prime_Divs;
            if (dt_Prime_Divs.Rows.Count == 0)
            {
                splitContainer1.Panel2.Enabled  = false;
                splitContainer1.IsSplitterFixed = true;
                lb_MissingDivs.Visible          = false;
                dg_MissingDivs.Visible          = false;
                bt_Reconcile.Visible            = false;
                lb_TotalAmount.Visible          = false;
                tb_TotalAmount.Visible          = false;
                lb_Amount.Visible = false;
                tb_Amount.Visible = false;
                this.Height       = splitContainer1.Top + splitContainer1.Panel1.Height + 50;
                splitContainer1.SplitterDistance = splitContainer1.Height;

                /*
                 * this.Height = lb_MissingDivs.Top;
                 * dg_Dividends.Height = this.Height - dg_Dividends.Top - 50;
                 */
            }
            else
            {
                for (int i = 0; i < dg_MissingDivs.Columns.Count; i++)
                {
                    dg_MissingDivs.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                }
                dg_MissingDivs.Columns["FundID"].Visible = false;
                dg_MissingDivs.Columns["Ex Date"].DefaultCellStyle.Format      = "dd-MMM-yyyy";
                dg_MissingDivs.Columns["Payable Date"].DefaultCellStyle.Format = "dd-MMM-yyyy";
                dg_MissingDivs.Columns["GPB_Transaction_ID"].Visible           = false;
                ParentForm1.SetFormatColumn(dg_MissingDivs, "Quantity", Color.Empty, Color.Empty, "N0", "0");
                ParentForm1.SetFormatColumn(dg_MissingDivs, "Amount", Color.Empty, Color.Empty, "N4", "0");
                dg_MissingDivs.Columns["Quantity"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                dg_MissingDivs.Columns["Amount"].DefaultCellStyle.Alignment   = DataGridViewContentAlignment.MiddleRight;

                // Loop over the Rows
                for (Int32 i = 0; i < dg_MissingDivs.Rows.Count; i++) // Last row in dg_ReportPosition is a blank row
                {
                    if (dg_MissingDivs["BBG_Ticker", i].Value != null)
                    {
                        ParentForm1.SetColumn(dg_MissingDivs, "Quantity", i);
                        ParentForm1.SetColumn(dg_MissingDivs, "Amount", i);
                    }
                }

                dg_MissingDivs.Columns["Reconcilled"].Visible = false;

                if (!dg_MissingDivs.Columns.Contains("IsReconcilled"))
                {
                    System.Windows.Forms.DataGridViewCheckBoxColumn IsReconcilled = new System.Windows.Forms.DataGridViewCheckBoxColumn();
                    IsReconcilled.DataPropertyName = "Reconcilled";
                    IsReconcilled.FalseValue       = "N";
                    IsReconcilled.HeaderText       = "Reconcilled";
                    IsReconcilled.Name             = "IsReconcilled";
                    IsReconcilled.Resizable        = System.Windows.Forms.DataGridViewTriState.True;
                    IsReconcilled.SortMode         = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
                    IsReconcilled.TrueValue        = "Y";
                    IsReconcilled.Width            = 67;
                    dg_MissingDivs.Columns.Insert(0, IsReconcilled);
                }
            }
        } //LoadMissingDivs()
Example #37
0
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        protected override void InitializeComponent()
        {
            this.GbxCustomerList        = new System.Windows.Forms.GroupBox();
            this.CupttsUers             = new CustomControlLib.CUserPageTurnToolStrip();
            this.DgvCustomer            = new System.Windows.Forms.DataGridView();
            this.Column1                = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column2                = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column3                = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column4                = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column12               = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column13               = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column5                = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column6                = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column11               = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column7                = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column9                = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column8                = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column10               = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.CheckBoxS              = new System.Windows.Forms.DataGridViewCheckBoxColumn();
            this.CbSelectAllSound       = new System.Windows.Forms.CheckBox();
            this.dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
            this.GbxCustomerFind        = new System.Windows.Forms.GroupBox();
            this.CboCustomerData        = new System.Windows.Forms.ComboBox();
            this.BtnCustomerFind        = new System.Windows.Forms.Button();
            this.BtnCustomerDelete      = new System.Windows.Forms.Button();
            this.BtnCustomerAdd         = new System.Windows.Forms.Button();
            this.BtnCustomerModify      = new System.Windows.Forms.Button();
            this.CTxtCustomerData       = new CustomControlLib.CUserTextButton();
            this.CboCustomerCondition   = new System.Windows.Forms.ComboBox();
            this.LblCustomerData        = new System.Windows.Forms.Label();
            this.LblCustomerCondition   = new System.Windows.Forms.Label();
            this.BtnBatchModify         = new System.Windows.Forms.Button();
            this.SuspendLayout();
            this.GbxCustomerList.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.DgvCustomer)).BeginInit();
            this.GbxCustomerFind.SuspendLayout();
            //
            // tabPage1
            //
            this.BackColor = System.Drawing.SystemColors.Control;
            this.Controls.Add(this.GbxCustomerList);
            this.Controls.Add(this.GbxCustomerFind);
            this.Location = new System.Drawing.Point(4, 26);
            this.Margin   = new System.Windows.Forms.Padding(4);
            this.Name     = "tabPage1";
            this.Padding  = new System.Windows.Forms.Padding(4);
            this.Size     = new System.Drawing.Size(841, 487);
            this.TabIndex = 0;
            this.Text     = "车主管理";
            //
            // GbxCustomerList
            //
            this.GbxCustomerList.Controls.Add(this.BtnBatchModify);
            this.GbxCustomerList.Controls.Add(this.CbSelectAllSound);
            this.GbxCustomerList.Controls.Add(this.CupttsUers);
            this.GbxCustomerList.Controls.Add(this.DgvCustomer);
            this.GbxCustomerList.Location = new System.Drawing.Point(0, 140);
            this.GbxCustomerList.Margin   = new System.Windows.Forms.Padding(4);
            this.GbxCustomerList.Name     = "GbxCustomerList";
            this.GbxCustomerList.Padding  = new System.Windows.Forms.Padding(4);
            this.GbxCustomerList.Size     = new System.Drawing.Size(837, 347);
            this.GbxCustomerList.TabIndex = 1;
            this.GbxCustomerList.TabStop  = false;
            this.GbxCustomerList.Text     = "车主列表";
            //
            // BtnSaveSound
            //
            this.BtnBatchModify.Location = new System.Drawing.Point(100, 20);
            this.BtnBatchModify.Margin   = new System.Windows.Forms.Padding(4);
            this.BtnBatchModify.Name     = "BtnBatchModify";
            this.BtnBatchModify.Size     = new System.Drawing.Size(100, 30);
            this.BtnBatchModify.TabIndex = 9;
            this.BtnBatchModify.Text     = "批量修改";
            this.BtnBatchModify.UseVisualStyleBackColor = true;
            this.BtnBatchModify.Click += new System.EventHandler(this.BtnBatchModify_Click);
            //
            // CupttsUers
            //
            this.CupttsUers.Dock       = System.Windows.Forms.DockStyle.Bottom;
            this.CupttsUers.Font       = new System.Drawing.Font("微软雅黑", 12F);
            this.CupttsUers.Location   = new System.Drawing.Point(4, 354);
            this.CupttsUers.Name       = "CupttsUers";
            this.CupttsUers.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
            this.CupttsUers.Size       = new System.Drawing.Size(829, 33);
            this.CupttsUers.TabIndex   = 8;
            this.CupttsUers.Tag        = this.DgvCustomer;
            this.CupttsUers.Text       = "CupttsUers";
            //
            // DgvCustomer
            //
            this.DgvCustomer.AllowUserToAddRows    = false;
            this.DgvCustomer.AllowUserToResizeRows = false;
            this.DgvCustomer.AutoSizeColumnsMode   = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
            this.DgvCustomer.AutoGenerateColumns   = false;
            this.DgvCustomer.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
                this.Column1,
                this.Column2,
                this.Column3,
                this.Column4,
                this.Column5,
                this.Column6,
                this.Column7,
                this.Column9,
                this.Column8,
                this.Column10,
                this.Column11,
                this.Column12,
                this.Column13,
                this.CheckBoxS
            });
            this.DgvCustomer.Location           = new System.Drawing.Point(3, 60);
            this.DgvCustomer.Name               = "DgvCustomer";
            this.DgvCustomer.RowHeadersVisible  = false;
            this.DgvCustomer.SelectionMode      = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
            this.DgvCustomer.Size               = new System.Drawing.Size(829, 270);
            this.DgvCustomer.TabIndex           = 0;
            this.DgvCustomer.CellDoubleClick   += new System.Windows.Forms.DataGridViewCellEventHandler(base.DgvCustomer_CellDoubleClick);
            this.DgvCustomer.CellFormatting    += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(base.DgvCustomer_CellFormatting);
            this.DgvCustomer.DataSourceChanged += new EventHandler(this.CupttsUers.UpdateLayout);
            //
            // Column1
            //
            this.Column1.DataPropertyName = "strName";
            //this.Column1.FillWeight = 72.63921F;
            this.Column1.HeaderText = "姓名";
            this.Column1.Name       = "Column1";
            this.Column1.ReadOnly   = true;
            //
            // Column2
            //
            this.Column2.DataPropertyName = "strICCardID";
            //this.Column2.FillWeight = 79.48557F;
            this.Column2.HeaderText = "用户卡号";
            this.Column2.Name       = "Column2";
            this.Column2.ReadOnly   = true;
            //
            // Column3
            //
            this.Column3.DataPropertyName = "nICCardStatus";
            //this.Column3.FillWeight = 85.48165F;
            this.Column3.HeaderText = "卡状态";
            this.Column3.Name       = "Column3";
            this.Column3.ReadOnly   = true;
            //
            // Column4
            //
            this.Column4.DataPropertyName = "nICCardType";
            //this.Column4.FillWeight = 90.6097F;
            this.Column4.HeaderText = "卡类型";
            this.Column4.Name       = "Column4";
            this.Column4.ReadOnly   = true;
            //
            // Column12
            //
            this.Column12.DataPropertyName = "dtStartTime";
            this.Column12.FillWeight       = 210.6097F;
            dataGridViewCellStyle1.Format  = "yyyy-MM-dd HH:mm:ss";
            this.Column12.DefaultCellStyle = dataGridViewCellStyle1;
            this.Column12.HeaderText       = "起始日期";
            this.Column12.Name             = "Column2";
            this.Column12.ReadOnly         = true;
            //
            // Column13
            //
            this.Column13.DataPropertyName = "dtDeadLine";
            this.Column13.FillWeight       = 210.6097F;
            this.Column13.DefaultCellStyle = dataGridViewCellStyle1;
            this.Column13.HeaderText       = "截止日期";
            this.Column13.Name             = "Column3";
            this.Column13.ReadOnly         = true;
            //
            // Column5
            //
            this.Column5.DataPropertyName = "nWareHouse";
            //this.Column5.FillWeight = 95.23381F;
            this.Column5.HeaderText = "库区";
            this.Column5.Name       = "Column5";
            this.Column5.ReadOnly   = true;
            //
            // Column6
            //
            this.Column6.DataPropertyName = "strCarPOSN";
            //this.Column6.FillWeight = 99.75758F;
            this.Column6.HeaderText = "分配车位";
            this.Column6.Name       = "Column6";
            this.Column6.ReadOnly   = true;
            //
            // Column11
            //
            this.Column11.DataPropertyName = "nPriorityID";
            //this.Column11.FillWeight = 99.75758F;
            this.Column11.HeaderText = "优先级";
            this.Column11.Name       = "Column11";
            this.Column11.ReadOnly   = true;
            //
            // Column7
            //
            this.Column7.DataPropertyName = "strTelphone";
            //this.Column7.FillWeight = 104.7255F;
            this.Column7.HeaderText = "住宅电话";
            this.Column7.Name       = "Column7";
            this.Column7.ReadOnly   = true;
            //
            // Column9
            //
            this.Column9.DataPropertyName = "strMobile";
            //this.Column9.FillWeight = 111.502F;
            this.Column9.HeaderText = "移动电话";
            this.Column9.Name       = "Column9";
            this.Column9.ReadOnly   = true;
            //
            // Column8
            //
            this.Column8.DataPropertyName = "strLicPlteNbr";
            //this.Column8.FillWeight = 121.858F;
            this.Column8.HeaderText = "车牌号";
            this.Column8.Name       = "Column8";
            this.Column8.ReadOnly   = true;
            //
            // Column10
            //
            this.Column10.DataPropertyName = "strAddress";
            //this.Column10.FillWeight = 138.7068F;
            this.Column10.HeaderText = "住址";
            this.Column10.Name       = "Column10";
            this.Column10.ReadOnly   = true;
            //
            // CheckBoxS
            //
            //this.CheckBoxS.DataPropertyName = "soundishand";
            //this.CheckBoxS.FillWeight = 46.08193F;
            this.CheckBoxS.HeaderText = "选择";
            this.CheckBoxS.Name       = "CheckBoxS";
            this.CheckBoxS.Resizable  = System.Windows.Forms.DataGridViewTriState.True;
            this.CheckBoxS.TrueValue  = true;
            this.CheckBoxS.FalseValue = false;
            //
            // CbSelectAllSound
            //
            this.CbSelectAllSound.AutoSize = true;
            this.CbSelectAllSound.Location = new System.Drawing.Point(900, 25);
            this.CbSelectAllSound.Margin   = new System.Windows.Forms.Padding(4);
            this.CbSelectAllSound.Name     = "CbSelectAllSound";
            this.CbSelectAllSound.Size     = new System.Drawing.Size(30, 20);
            this.CbSelectAllSound.TabIndex = 10;
            this.CbSelectAllSound.Text     = "全选";
            this.CbSelectAllSound.UseVisualStyleBackColor = true;
            this.CbSelectAllSound.CheckedChanged         += new System.EventHandler(this.CbSelectAllSound_CheckedChanged);
            //
            // GbxCustomerFind
            //
            this.GbxCustomerFind.Controls.Add(this.CboCustomerData);
            this.GbxCustomerFind.Controls.Add(this.BtnCustomerFind);
            this.GbxCustomerFind.Controls.Add(this.BtnCustomerDelete);
            this.GbxCustomerFind.Controls.Add(this.BtnCustomerAdd);
            this.GbxCustomerFind.Controls.Add(this.BtnCustomerModify);
            this.GbxCustomerFind.Controls.Add(this.CTxtCustomerData);
            this.GbxCustomerFind.Controls.Add(this.CboCustomerCondition);
            this.GbxCustomerFind.Controls.Add(this.LblCustomerData);
            this.GbxCustomerFind.Controls.Add(this.LblCustomerCondition);
            this.GbxCustomerFind.Location = new System.Drawing.Point(0, 11);
            this.GbxCustomerFind.Margin   = new System.Windows.Forms.Padding(4);
            this.GbxCustomerFind.Name     = "GbxCustomerFind";
            this.GbxCustomerFind.Padding  = new System.Windows.Forms.Padding(4);
            this.GbxCustomerFind.Size     = new System.Drawing.Size(837, 120);
            this.GbxCustomerFind.TabIndex = 0;
            this.GbxCustomerFind.TabStop  = false;
            this.GbxCustomerFind.Text     = "车主查询";
            //
            // CboCustomerData
            //
            this.CboCustomerData.DropDownStyle     = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.CboCustomerData.FlatStyle         = System.Windows.Forms.FlatStyle.Popup;
            this.CboCustomerData.FormattingEnabled = true;
            this.CboCustomerData.Location          = new System.Drawing.Point(150, 81);
            this.CboCustomerData.Name     = "CboCustomerData";
            this.CboCustomerData.Size     = new System.Drawing.Size(240, 24);
            this.CboCustomerData.TabIndex = 8;
            this.CboCustomerData.Visible  = false;
            //
            // BtnCustomerFind
            //
            this.BtnCustomerFind.Location = new System.Drawing.Point(524, 35);
            this.BtnCustomerFind.Margin   = new System.Windows.Forms.Padding(4);
            this.BtnCustomerFind.Name     = "BtnCustomerFind";
            this.BtnCustomerFind.Size     = new System.Drawing.Size(100, 31);
            this.BtnCustomerFind.TabIndex = 7;
            this.BtnCustomerFind.Text     = "查询";
            this.BtnCustomerFind.UseVisualStyleBackColor = true;
            this.BtnCustomerFind.Click += new System.EventHandler(this.BtnCustomerFind_Click);
            //
            // BtnCustomerClose
            //
            this.BtnCustomerDelete.Location = new System.Drawing.Point(689, 81);
            this.BtnCustomerDelete.Margin   = new System.Windows.Forms.Padding(4);
            this.BtnCustomerDelete.Name     = "BtnCustomerClose";
            this.BtnCustomerDelete.Size     = new System.Drawing.Size(100, 31);
            this.BtnCustomerDelete.TabIndex = 6;
            this.BtnCustomerDelete.Text     = "删除";
            this.BtnCustomerDelete.UseVisualStyleBackColor = true;
            this.BtnCustomerDelete.Click += new System.EventHandler(this.BtnCustomerDelete_Click);
            //
            // BtnCustomerAdd
            //
            this.BtnCustomerAdd.Location = new System.Drawing.Point(524, 81);
            this.BtnCustomerAdd.Margin   = new System.Windows.Forms.Padding(4);
            this.BtnCustomerAdd.Name     = "BtnCustomerAdd";
            this.BtnCustomerAdd.Size     = new System.Drawing.Size(100, 31);
            this.BtnCustomerAdd.TabIndex = 5;
            this.BtnCustomerAdd.Text     = "添加";
            this.BtnCustomerAdd.UseVisualStyleBackColor = true;
            this.BtnCustomerAdd.Click += new System.EventHandler(this.BtnCustomerAdd_Click);
            //
            // BtnCustomerModify
            //
            this.BtnCustomerModify.Location = new System.Drawing.Point(689, 35);
            this.BtnCustomerModify.Margin   = new System.Windows.Forms.Padding(4);
            this.BtnCustomerModify.Name     = "BtnCustomerModify";
            this.BtnCustomerModify.Size     = new System.Drawing.Size(100, 31);
            this.BtnCustomerModify.TabIndex = 4;
            this.BtnCustomerModify.Text     = "修改";
            this.BtnCustomerModify.UseVisualStyleBackColor = true;
            this.BtnCustomerModify.Click += new System.EventHandler(this.BtnCustomerModify_Click);
            //
            // CTxtCustomerData
            //
            this.CTxtCustomerData.Enabled       = false;
            this.CTxtCustomerData.EnabledButton = false;
            this.CTxtCustomerData.EnmTxtType    = CustomControlLib.EnmTxtBoxType.Init;
            this.CTxtCustomerData.ImageButton   = null;
            this.CTxtCustomerData.Location      = new System.Drawing.Point(150, 81);
            this.CTxtCustomerData.Margin        = new System.Windows.Forms.Padding(4);
            this.CTxtCustomerData.Name          = "CTxtCustomerData";
            this.CTxtCustomerData.Size          = new System.Drawing.Size(240, 26);
            this.CTxtCustomerData.TabIndex      = 3;
            //this.CTxtCustomerData.CallbackTextButtonEvent += BtnCloseClick
            //
            // CboCustomerCondition
            //
            this.CboCustomerCondition.FormattingEnabled = true;
            this.CboCustomerCondition.Items.AddRange(new object[] {
                "用户卡号",
                "库区",
                "卡类型",
                "卡状态",
                //"分配车位",
                "姓名",
                "移动电话",
                "车牌号",
                "所有"
            });
            this.CboCustomerCondition.Location              = new System.Drawing.Point(150, 35);
            this.CboCustomerCondition.Margin                = new System.Windows.Forms.Padding(4);
            this.CboCustomerCondition.Name                  = "CboCustomerCondition";
            this.CboCustomerCondition.Size                  = new System.Drawing.Size(240, 24);
            this.CboCustomerCondition.TabIndex              = 2;
            this.CboCustomerCondition.Text                  = "所有";
            this.CboCustomerCondition.SelectedIndexChanged += new EventHandler(CboCustomerCondition_SelectedIndexChanged);
            this.CboCustomerCondition.DropDownStyle         = ComboBoxStyle.DropDownList;
            this.CboCustomerCondition.FlatStyle             = FlatStyle.Popup;
            //
            // LblCustomerData
            //
            this.LblCustomerData.Location    = new System.Drawing.Point(3, 81);
            this.LblCustomerData.Margin      = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.LblCustomerData.Name        = "label2";
            this.LblCustomerData.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
            this.LblCustomerData.Size        = new System.Drawing.Size(147, 27);
            this.LblCustomerData.TabIndex    = 1;
            this.LblCustomerData.Text        = "查询数据";
            //
            // LblCustomerCondition
            //
            this.LblCustomerCondition.Location    = new System.Drawing.Point(3, 35);
            this.LblCustomerCondition.Margin      = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.LblCustomerCondition.Name        = "label1";
            this.LblCustomerCondition.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
            this.LblCustomerCondition.Size        = new System.Drawing.Size(147, 27);
            this.LblCustomerCondition.TabIndex    = 0;
            this.LblCustomerCondition.Text        = "查询条件";


            this.ResumeLayout(false);
            this.GbxCustomerList.ResumeLayout(false);
            this.GbxCustomerList.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.DgvCustomer)).EndInit();
            this.GbxCustomerFind.ResumeLayout(false);
            this.GbxCustomerFind.PerformLayout();
            this.ResumeLayout(false);
        }
        private void SetParaToDepartmentUI(ref DataGridView dataGridView, Object obj)
        {
            dataGridView.Rows.Clear();

            if (dataGridView.Equals(editDepartmentDataGridView) == true)
            {
                if (((ArrayList)obj).Count > 0)
                {
                    dataGridView.Rows.Add(((ArrayList)obj).Count);
                    for (int i = 0; i < ((ArrayList)obj).Count; i++)
                    {
                        dataGridView.Rows[i].SetValues(((ArrayList)obj)[i]);
                    }
                }
            }
            else if (dataGridView.Equals(accountTypeDataGridView) == true)
            {
                if (((AccountTypeTable)obj).Count > 0)
                {
                    dataGridView.Rows.Add(((AccountTypeTable)obj).Count);
                    int idx = 0;
                    foreach (string accountName in ((AccountTypeTable)obj).Keys)
                    {
                        dataGridView.Rows[idx].SetValues(accountName, ((AccountTypeTable)obj)[accountName]);
                        idx++;
                    }
                }
            }
            else if (dataGridView.Equals(accessFunctionDataGridView) == true)
            {
                if (((AccessFunctionTable)obj).Count > 0)
                {
                    dataGridView.Rows.Add(((AccessFunctionTable)obj).Count);

                    for (int idx = 0; idx < ((AccessFunctionTable)obj).Count; idx++)
                    {
                        dataGridView.Rows[idx].SetValues(((AccessFunction)((AccessFunctionTable)obj)[idx]).AccessFunctionName);
                    }
                }
            }
            else if (dataGridView.Equals(userAccountDataGridView) == true)
            {
                dataGridView.Rows.Clear();
                if (((ArrayList)obj).Count > 0)
                {
                    dataGridView.Rows.Add(((ArrayList)obj).Count);

                    for (int idx = 0; idx < ((ArrayList)obj).Count; idx++)
                    {
                        dataGridView.Rows[idx].SetValues(idx + 1, ((UserAccount)((ArrayList)obj)[idx]).LoginID,
                                                         ((UserAccount)((ArrayList)obj)[idx]).Department,
                                                         ((UserAccount)((ArrayList)obj)[idx]).UserName,
                                                         ((UserAccount)((ArrayList)obj)[idx]).AccountType.GetFirstAccountTypeName(),
                                                         ((UserAccount)((ArrayList)obj)[idx]).Description);
                    }
                    dataGridView_Sorted(userAccountDataGridView, null);
                }
            }
            else if (dataGridView.Equals(functionAccessDataGridView) == true)
            {
                if (((AccessFunctionTable)obj).Count > 0)
                {
                    System.Windows.Forms.DataGridViewColumn[] dataGridColumn = new System.Windows.Forms.DataGridViewColumn[accountTypeTable.Count];

                    AccountTypeTable accountTypeTableTemp = new AccountTypeTable();
                    foreach (string strAccount in accountTypeTable.Keys)
                    {
                        accountTypeTableTemp.AddType(strAccount, (int)(accountTypeTable[strAccount]));
                    }

                    int iColumnIdx = 0;
                    for (int i = 100; i >= 0; i--)
                    {
                        foreach (string strAccount in accountTypeTableTemp.Keys)
                        {
                            if (((int)accountTypeTableTemp[strAccount]) == i)
                            {
                                accountTypeTableTemp.Remove(strAccount);

                                System.Windows.Forms.DataGridViewCheckBoxColumn column = new System.Windows.Forms.DataGridViewCheckBoxColumn();

                                column.HeaderText = strAccount;
                                column.Name       = "AccessFuncColumn" + i;
                                column.Width      = 100;
                                column.ReadOnly   = true;

                                dataGridColumn[iColumnIdx] = column;
                                iColumnIdx++;

                                //避免重複印出
                                foreach (DataGridViewColumn ExistColumn in this.functionAccessDataGridView.Columns)
                                {
                                    if (ExistColumn.HeaderText == strAccount)
                                    {
                                        this.functionAccessDataGridView.Columns.Remove(ExistColumn);
                                        break;
                                    }
                                }

                                break;
                            }
                        }
                    }

                    this.functionAccessDataGridView.Columns.AddRange(dataGridColumn);

                    dataGridView.Rows.Add(((AccessFunctionTable)obj).Count);
                    for (int idx = 0; idx < ((AccessFunctionTable)obj).Count; idx++)
                    {
                        dataGridView.Rows[idx].SetValues(idx + 1, ((AccessFunction)((AccessFunctionTable)obj)[idx]).AccessFunctionName);
                        foreach (string strAccount in ((AccessFunction)accessFunctionTable[idx]).AccountType.Keys)
                        {
                            for (int columnIdx = 2; columnIdx < functionAccessDataGridView.ColumnCount; columnIdx++)
                            {
                                if (strAccount.Equals(functionAccessDataGridView.Columns[columnIdx].HeaderText))
                                {
                                    functionAccessDataGridView.Rows[idx].Cells[columnIdx].Value = true;
                                }
                                //functionAccessDataGridView.Rows[idx].Cells[columnIdx].ReadOnly = strAccount.Equals(functionAccessDataGridView.Columns[columnIdx].HeaderText);
                            }
                        }
                    }
                }
            }
        }
Example #39
0
        private void InitializeComponent()
        {
            this.components              = new System.ComponentModel.Container();
            this.dataGridView1           = new System.Windows.Forms.DataGridView();
            this.RowCol                  = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.NameCol                 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.TypeCol                 = new System.Windows.Forms.DataGridViewComboBoxColumn();
            this.ArchiveCol              = new System.Windows.Forms.DataGridViewCheckBoxColumn();
            this.RetriggerCol            = new System.Windows.Forms.DataGridViewComboBoxColumn();
            this.PrintCol                = new System.Windows.Forms.DataGridViewCheckBoxColumn();
            this.IDCol                   = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.ReadOnlyCol             = new DataGridViewCheckBoxColumn();
            this.contextMenuStrip1       = new System.Windows.Forms.ContextMenuStrip(this.components);
            this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.addToolStripMenuItem    = new System.Windows.Forms.ToolStripMenuItem();
            this.copyToolStripMenuItem   = new System.Windows.Forms.ToolStripMenuItem();
            this.pasteToolStripMenuItem  = new System.Windows.Forms.ToolStripMenuItem();
            this.panelTabPage            = new System.Windows.Forms.Panel();
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
            this.SuspendLayout();
            //
            // dataGridView1
            //
            this.dataGridView1.AllowUserToAddRows          = false;
            this.dataGridView1.AllowUserToDeleteRows       = false;
            this.dataGridView1.AllowUserToResizeRows       = false;
            this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
                this.RowCol,
                this.NameCol,
                this.TypeCol,
                this.ArchiveCol,
                this.RetriggerCol,
                this.PrintCol,
                this.IDCol,
                this.ReadOnlyCol
            });
            //this.dataGridView1.ContextMenuStrip = this.contextMenuStrip1;
            this.dataGridView1.Dock                = System.Windows.Forms.DockStyle.Fill;
            this.dataGridView1.Location            = new System.Drawing.Point(3, 3);
            this.dataGridView1.RowHeadersVisible   = false;
            this.dataGridView1.MultiSelect         = false;
            this.dataGridView1.Name                = "dataGridView1";
            this.dataGridView1.Size                = new System.Drawing.Size(563, 150);
            this.dataGridView1.TabIndex            = 0;
            this.dataGridView1.CellBeginEdit      += new System.Windows.Forms.DataGridViewCellCancelEventHandler(this.dataGridView1_CellBeginEdit);
            this.dataGridView1.CellValueChanged   += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellValueChanged);
            this.dataGridView1.ColumnWidthChanged += new System.Windows.Forms.DataGridViewColumnEventHandler(this.dataGridView1_ColumnWidthChanged);
            this.dataGridView1.CellMouseUp        += new DataGridViewCellMouseEventHandler(this.dataGridView1_CellMouseUp);
            this.dataGridView1.RowsAdded          += new System.Windows.Forms.DataGridViewRowsAddedEventHandler(this.dataGridView1_RowsAdded);

            //
            // RowCol
            //
            this.RowCol.HeaderText = "Row";
            this.RowCol.Name       = "RowCol";
            //
            // NameCol
            //
            this.NameCol.HeaderText = "Name";
            this.NameCol.Name       = "NameCol";
            //
            // TypeCol
            //
            this.TypeCol.HeaderText = "Type";
            this.TypeCol.Items.AddRange(new object[] {
                "Event",
                "Self Acknowledge",
                "Acknowledge on Set",
                "Acknowledge on Set/Reset"
            });
            this.TypeCol.Name = "TypeCol";
            //
            // ArchiveCol
            //
            this.ArchiveCol.HeaderText = "Archive";
            this.ArchiveCol.Name       = "ArchiveCol";
            //
            // RetriggerCol
            //
            this.RetriggerCol.HeaderText = "Retrigger";
            this.RetriggerCol.Items.AddRange(new object[] {
                "No",
                "1 Minute",
                "10 Minute",
                "1 Hour"
            });
            this.RetriggerCol.Name      = "RetriggerCol";
            this.RetriggerCol.Resizable = System.Windows.Forms.DataGridViewTriState.True;
            //
            // PrintCol
            //
            this.PrintCol.HeaderText = "Print";
            this.PrintCol.Name       = "PrintCol";
            //
            // IDCol
            //
            this.IDCol.HeaderText = "ID";
            this.IDCol.Name       = "IDCol";
            //
            // ReadOnlyCol
            //
            this.ReadOnlyCol.HeaderText = "ReadOnly";
            this.ReadOnlyCol.Name       = "ReadOnlyCol";
            //
            // contextMenuStrip1
            //
            this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
                this.deleteToolStripMenuItem,
                this.addToolStripMenuItem,
                this.copyToolStripMenuItem,
                this.pasteToolStripMenuItem
            });
            this.contextMenuStrip1.Name = "contextMenuStrip1";
            this.contextMenuStrip1.Size = new System.Drawing.Size(102, 26);
            //
            // delteToolStripMenuItem
            //
            this.deleteToolStripMenuItem.Name   = "deleteToolStripMenuItem";
            this.deleteToolStripMenuItem.Size   = new System.Drawing.Size(101, 22);
            this.deleteToolStripMenuItem.Text   = "Delete";
            this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click);
            //
            // addToolStripMenuItem
            //
            this.addToolStripMenuItem.Name   = "addToolStripMenuItem";
            this.addToolStripMenuItem.Size   = new System.Drawing.Size(101, 22);
            this.addToolStripMenuItem.Text   = "Add";
            this.addToolStripMenuItem.Click += new System.EventHandler(this.addToolStripMenuItem_Click);
            //
            // copyToolStripMenuItem
            //
            this.copyToolStripMenuItem.Name   = "copyToolStripMenuItem";
            this.copyToolStripMenuItem.Size   = new System.Drawing.Size(101, 22);
            this.copyToolStripMenuItem.Text   = "Copy";
            this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
            //
            // pasteToolStripMenuItem
            //
            this.pasteToolStripMenuItem.Name   = "pasteToolStripMenuItem";
            this.pasteToolStripMenuItem.Size   = new System.Drawing.Size(101, 22);
            this.pasteToolStripMenuItem.Text   = "Paste";
            this.pasteToolStripMenuItem.Click += new System.EventHandler(this.pasteToolStripMenuItem_Click);
            //
            // panelTabPage
            //
            this.panelTabPage.AutoScroll = true;
            this.panelTabPage.BackColor  = System.Drawing.SystemColors.ActiveCaption;
            this.panelTabPage.Controls.Add(this.dataGridView1);
            this.panelTabPage.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.panelTabPage.Location = new System.Drawing.Point(0, 0);
            this.panelTabPage.Name     = "panelTabPage";
            this.panelTabPage.Size     = new System.Drawing.Size(550, 187);
            this.panelTabPage.TabIndex = 0;
            //
            // TabGridPageControl
            //
            this.Controls.Add(this.panelTabPage);
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
            this.ResumeLayout(false);
        }
Example #40
0
        //慶忠版本
        public int LoadUI(string iniFilePath, CCIOMonitorUnitControl.IOType ioType)
        {
            string SectionName, KeyName;

            SuspendLayout();
            nowioType = ioType;

            IniFile iniFile          = new IniFile(iniFilePath);
            IniFile iniIOLogListFile = new IniFile(IOLogListINIPath);

            int dioNumber = iniFile.GetInt32("Info", (ioType == IOType.DI_TYPE) ? "DITotal" : "DOTotal", 0);

            IoLogCheckBoxUsable = iniFile.GetInt16("Info", "IoLogCheckBoxUsable", 1);

            tabPage     = new System.Windows.Forms.TabPage[(dioNumber % _DISPLAY_IO_NUM_PER_PAGE_) == 0 ? dioNumber / _DISPLAY_IO_NUM_PER_PAGE_ : dioNumber / _DISPLAY_IO_NUM_PER_PAGE_ + 1];
            diLEDLabel  = new System.Windows.Forms.Label[dioNumber];
            diNameLabel = new System.Windows.Forms.Label[dioNumber];

            //////////////////////////////////////////////////////////////////////////
            ioDataGridView = new System.Windows.Forms.DataGridView[(dioNumber % _DISPLAY_IO_NUM_PER_PAGE_) == 0 ? dioNumber / _DISPLAY_IO_NUM_PER_PAGE_ : dioNumber / _DISPLAY_IO_NUM_PER_PAGE_ + 1];

            IdxTest         = new System.Windows.Forms.DataGridViewTextBoxColumn[(dioNumber % _DISPLAY_IO_NUM_PER_PAGE_) == 0 ? dioNumber / _DISPLAY_IO_NUM_PER_PAGE_ : dioNumber / _DISPLAY_IO_NUM_PER_PAGE_ + 1, 4];
            CheckStatus     = new System.Windows.Forms.DataGridViewCheckBoxColumn[(dioNumber % _DISPLAY_IO_NUM_PER_PAGE_) == 0 ? dioNumber / _DISPLAY_IO_NUM_PER_PAGE_ : dioNumber / _DISPLAY_IO_NUM_PER_PAGE_ + 1, 4];
            IoStatus        = new System.Windows.Forms.DataGridViewButtonColumn[(dioNumber % _DISPLAY_IO_NUM_PER_PAGE_) == 0 ? dioNumber / _DISPLAY_IO_NUM_PER_PAGE_ : dioNumber / _DISPLAY_IO_NUM_PER_PAGE_ + 1, 4];
            DescriptionTest = new System.Windows.Forms.DataGridViewTextBoxColumn[(dioNumber % _DISPLAY_IO_NUM_PER_PAGE_) == 0 ? dioNumber / _DISPLAY_IO_NUM_PER_PAGE_ : dioNumber / _DISPLAY_IO_NUM_PER_PAGE_ + 1, 4];
            //////////////////////////////////////////////////////////////////////////

            tabControlEX.Controls.Clear();

            for (int tabIdx = 0; tabIdx < tabPage.Length; tabIdx++)
            {
                //
                // 建立TabPage
                //
                tabPage[tabIdx]          = new Dotnetrix.Controls.TabPageEX();
                tabPage[tabIdx].Location = new System.Drawing.Point(4, 21);
                tabPage[tabIdx].Name     = "sampleTabPage";
                tabPage[tabIdx].Padding  = new System.Windows.Forms.Padding(3);
                tabPage[tabIdx].Size     = new System.Drawing.Size(368, 434);
                tabPage[tabIdx].TabIndex = 0;
                tabPage[tabIdx].Text     = string.Format("{0}~{1}", tabIdx * _DISPLAY_IO_NUM_PER_PAGE_, (tabIdx + 1) * _DISPLAY_IO_NUM_PER_PAGE_ - 1);
                tabPage[tabIdx].UseVisualStyleBackColor = true;

                tabControlEX.Controls.Add(tabPage[tabIdx]);

                for (int i = 0; i < 4; i++)
                {
                    //////////////////////////////////////////////
                    // Idx
                    //
                    IdxTest[tabIdx, i]            = new System.Windows.Forms.DataGridViewTextBoxColumn();
                    IdxTest[tabIdx, i].HeaderText = "Idx";
                    IdxTest[tabIdx, i].Name       = "Column1";
                    IdxTest[tabIdx, i].ReadOnly   = true;
                    IdxTest[tabIdx, i].Width      = 30;//26

                    //////////////////////////////////////////////
                    //
                    // Log Check Box
                    //
                    CheckStatus[tabIdx, i]            = new System.Windows.Forms.DataGridViewCheckBoxColumn();
                    CheckStatus[tabIdx, i].FlatStyle  = System.Windows.Forms.FlatStyle.Popup;
                    CheckStatus[tabIdx, i].HeaderText = "Pass";
                    CheckStatus[tabIdx, i].Name       = "Pass";
                    CheckStatus[tabIdx, i].Width      = 25;//20
                    CheckStatus[tabIdx, i].ReadOnly   = false;
                    CheckStatus[tabIdx, i].FalseValue = false;
                    CheckStatus[tabIdx, i].TrueValue  = true;

                    //////////////////////////////////////////////
                    //
                    // Status
                    //
                    System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
                    IoStatus[tabIdx, i] = new System.Windows.Forms.DataGridViewButtonColumn();
                    dataGridViewCellStyle2.Alignment          = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
                    dataGridViewCellStyle2.BackColor          = System.Drawing.Color.Lime;
                    dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.Transparent;
                    IoStatus[tabIdx, i].DefaultCellStyle      = dataGridViewCellStyle2;
                    IoStatus[tabIdx, i].FlatStyle             = System.Windows.Forms.FlatStyle.Popup;
                    IoStatus[tabIdx, i].HeaderText            = "Status";
                    IoStatus[tabIdx, i].Name     = "Status";
                    IoStatus[tabIdx, i].ReadOnly = true;
                    IoStatus[tabIdx, i].Width    = 25;//20

                    /////////////////////////////////////////////////////////////////////////
                    //
                    // Description
                    //
                    DescriptionTest[tabIdx, i] = new System.Windows.Forms.DataGridViewTextBoxColumn();
                    //DescriptionTest[tabIdx, i].AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
                    DescriptionTest[tabIdx, i].HeaderText = "Description";
                    DescriptionTest[tabIdx, i].Name       = "Description";
                    DescriptionTest[tabIdx, i].ReadOnly   = true;
                    DescriptionTest[tabIdx, i].Width      = 194;//180
                }

                //
                // sampleDataGridView
                //
                ioDataGridView[tabIdx] = new System.Windows.Forms.DataGridView();
                tabPage[tabIdx].Controls.Add(ioDataGridView[tabIdx]);

                ioDataGridView[tabIdx].AllowUserToAddRows       = false;
                ioDataGridView[tabIdx].AllowUserToDeleteRows    = false;
                ioDataGridView[tabIdx].AllowUserToResizeColumns = false;
                ioDataGridView[tabIdx].AllowUserToResizeRows    = false;
                //ioDataGridView[tabIdx].AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.DisplayedCells;
                //ioDataGridView[tabIdx].ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
                ioDataGridView[tabIdx].ColumnHeadersVisible = false;
                ioDataGridView[tabIdx].Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
                    IdxTest[tabIdx, 0],
                    CheckStatus[tabIdx, 0],
                    IoStatus[tabIdx, 0],
                    DescriptionTest[tabIdx, 0],
                    IdxTest[tabIdx, 1],
                    CheckStatus[tabIdx, 1],
                    IoStatus[tabIdx, 1],
                    DescriptionTest[tabIdx, 1],
                    IdxTest[tabIdx, 2],
                    CheckStatus[tabIdx, 2],
                    IoStatus[tabIdx, 2],
                    DescriptionTest[tabIdx, 2],
                    IdxTest[tabIdx, 3],
                    CheckStatus[tabIdx, 3],
                    IoStatus[tabIdx, 3],
                    DescriptionTest[tabIdx, 3]
                });

                System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();

                dataGridViewCellStyle3.Alignment          = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
                dataGridViewCellStyle3.BackColor          = System.Drawing.SystemColors.Window;
                dataGridViewCellStyle3.Font               = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                dataGridViewCellStyle3.ForeColor          = System.Drawing.SystemColors.ControlText;
                dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
                dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
                dataGridViewCellStyle3.WrapMode           = System.Windows.Forms.DataGridViewTriState.False;
                ioDataGridView[tabIdx].DefaultCellStyle   = dataGridViewCellStyle3;

                //ioDataGridView[tabIdx].Dock = System.Windows.Forms.DockStyle.Fill;
                ioDataGridView[tabIdx].EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;

                ioDataGridView[tabIdx].Location    = sampleDataGridView.Location;
                ioDataGridView[tabIdx].MultiSelect = false;
                ioDataGridView[tabIdx].Name        = "sampleDataGridView";
                //ioDataGridView[tabIdx].ReadOnly = true;
                ioDataGridView[tabIdx].RowHeadersVisible       = false;
                ioDataGridView[tabIdx].RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
                ioDataGridView[tabIdx].SelectionMode           = System.Windows.Forms.DataGridViewSelectionMode.RowHeaderSelect;
                ioDataGridView[tabIdx].ScrollBars = System.Windows.Forms.ScrollBars.None;
                ioDataGridView[tabIdx].Size       = sampleDataGridView.Size;
                ioDataGridView[tabIdx].TabIndex   = 15;

                ioDataGridView[tabIdx].Rows.Add(_DISPLAY_IO_NUM_PER_COLUMN_);

                foreach (DataGridViewRow de in ioDataGridView[tabIdx].Rows)
                {
                    de.Height = 25;//19
                }
                string ioName;
                int    iColumnIdx = 0;
                int    iRowIdx    = 0;

                for (int ioIdx = 0; ioIdx < _DISPLAY_IO_NUM_PER_PAGE_; ioIdx++)
                {
                    //ioName = string.Format("{0}. ", ioIdx + _DISPLAY_IO_NUM_PER_PAGE_ * tabIdx) + iniFile.GetString((ioType == IOType.DI_TYPE) ? "DIName" : "DOName", string.Format("{0:D4}", ioIdx + _DISPLAY_IO_NUM_PER_PAGE_ * tabIdx), "");
                    ioName = iniFile.GetString((ioType == IOType.DI_TYPE) ? "DIName" : "DOName", string.Format("{0:D4}", ioIdx + _DISPLAY_IO_NUM_PER_PAGE_ * tabIdx), "");

                    if (ioIdx != 0 && ioIdx % _DISPLAY_IO_NUM_PER_COLUMN_ == 0)
                    {
                        iColumnIdx++;
                        iRowIdx = 0;
                    }
                    ioDataGridView[tabIdx].Rows[iRowIdx].Cells[0 + 4 * iColumnIdx].Value           = string.Format("{0}", ioIdx + _DISPLAY_IO_NUM_PER_PAGE_ * tabIdx);
                    ioDataGridView[tabIdx].Rows[iRowIdx].Cells[0 + 4 * iColumnIdx].Style.BackColor = Color.Black;
                    ioDataGridView[tabIdx].Rows[iRowIdx].Cells[0 + 4 * iColumnIdx].Style.ForeColor = Color.White;
                    ioDataGridView[tabIdx].Rows[iRowIdx].Cells[1 + 4 * iColumnIdx].Style.BackColor = Color.Black;
                    ioDataGridView[tabIdx].Rows[iRowIdx].Cells[1 + 4 * iColumnIdx].Style.ForeColor = Color.White;
                    ioDataGridView[tabIdx].Rows[iRowIdx].Cells[1 + 4 * iColumnIdx].Value           = false;
                    ioDataGridView[tabIdx].Rows[iRowIdx].Cells[2 + 4 * iColumnIdx].Style.BackColor = Color.Red;
                    ioDataGridView[tabIdx].Rows[iRowIdx].Cells[3 + 4 * iColumnIdx].Value           = ioName;
                    ioDataGridView[tabIdx].Rows[iRowIdx].Cells[3 + 4 * iColumnIdx].Style.ForeColor = Color.White;
                    ioDataGridView[tabIdx].Rows[iRowIdx].Cells[3 + 4 * iColumnIdx].Style.BackColor = Color.Gray;

                    //Load IO Log Check List
                    SectionName = (nowioType == IOType.DI_TYPE) ? "DI Check List" : "DO Check List";
                    KeyName     = ((nowioType == IOType.DI_TYPE) ? "DI" : "DO") + (string)ioDataGridView[tabIdx].Rows[iRowIdx].Cells[0 + 4 * iColumnIdx].Value;
                    ioDataGridView[tabIdx].Rows[iRowIdx].Cells[1 + 4 * iColumnIdx].Value = iniIOLogListFile.GetInt32(SectionName, KeyName, 1) == 1;

                    iRowIdx++;
                }

                tabPageNumber++;
            }

            for (int i = 0; i < tabPageNumber; i++)
            {
                ioDataGridView[i].CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(IoLogDataGridView_CellContentClick);
            }

            ResumeLayout();
            return(0);
        }
Example #41
0
        private DataGridView NewLightView()
        {
            DataGridView LightView = new System.Windows.Forms.DataGridView();

            LightView.CellClick += new DataGridViewCellEventHandler(lightView_CellClick);

            #region Colums
            DataGridViewTextBoxColumn  lid      = new System.Windows.Forms.DataGridViewTextBoxColumn();
            DataGridViewTextBoxColumn  lRoom    = new System.Windows.Forms.DataGridViewTextBoxColumn();
            DataGridViewTextBoxColumn  lLoc     = new System.Windows.Forms.DataGridViewTextBoxColumn();
            DataGridViewTextBoxColumn  lModel   = new System.Windows.Forms.DataGridViewTextBoxColumn();
            DataGridViewTextBoxColumn  lMake    = new System.Windows.Forms.DataGridViewTextBoxColumn();
            DataGridViewTextBoxColumn  lHeads   = new System.Windows.Forms.DataGridViewTextBoxColumn();
            DataGridViewTextBoxColumn  lPow     = new System.Windows.Forms.DataGridViewTextBoxColumn();
            DataGridViewTextBoxColumn  lVolts   = new System.Windows.Forms.DataGridViewTextBoxColumn();
            DataGridViewCheckBoxColumn lReqServ = new System.Windows.Forms.DataGridViewCheckBoxColumn();
            DataGridViewTextBoxColumn  lSerial  = new System.Windows.Forms.DataGridViewTextBoxColumn();
            DataGridViewTextBoxColumn  lBarCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
            DataGridViewTextBoxColumn  lManDate = new System.Windows.Forms.DataGridViewTextBoxColumn();
            DataGridViewButtonColumn   lDel     = new DataGridViewButtonColumn();

            lid.HeaderText      = "ID";
            lid.Name            = "lid";
            lid.Visible         = false;
            lLoc.HeaderText     = "Location";
            lLoc.Name           = "lLoc";
            lLoc.Width          = 80;
            lModel.HeaderText   = "Model";
            lModel.Name         = "lModel";
            lModel.Width        = 80;
            lMake.HeaderText    = "Make";
            lMake.Name          = "lMake";
            lMake.Width         = 60;
            lHeads.HeaderText   = "Heads";
            lHeads.Name         = "lHeads";
            lHeads.Width        = 60;
            lPow.HeaderText     = "Watts";
            lPow.Name           = "lPow";
            lPow.Width          = 60;
            lVolts.HeaderText   = "Volts";
            lVolts.Name         = "lVolts";
            lVolts.Width        = 60;
            lReqServ.HeaderText = "Service";
            lReqServ.Name       = "lReqServ";
            lReqServ.Width      = 60;
            lSerial.HeaderText  = "Serial";
            lSerial.Name        = "lSerial";
            lSerial.Width       = 150;
            lRoom.HeaderText    = "Room";
            lRoom.Name          = "lRoom";
            lRoom.Visible       = false;
            lRoom.Width         = 60;
            lBarCode.HeaderText = "Bar Code";
            lBarCode.Name       = "Bar Code";
            lBarCode.Width      = 80;
            lManDate.HeaderText = "Manufacturing Date";
            lManDate.Name       = "lManDate";
            lManDate.Width      = 150;
            lDel.HeaderText     = "Delete";
            lDel.Name           = "lDel";
            lDel.Width          = 40;
            #endregion

            LightView.AllowUserToAddRows          = false;
            LightView.AllowUserToDeleteRows       = false;
            LightView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            LightView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
                lid,
                lLoc,
                lModel,
                lMake,
                lHeads,
                lPow,
                lVolts,
                lReqServ,
                lSerial,
                lRoom,
                lBarCode,
                lManDate,
                lDel
            });

            LightView.Location = new System.Drawing.Point(5, 220);
            LightView.Name     = "LightView";
            LightView.Size     = new System.Drawing.Size(AddItemButton.Location.X - LightView.Location.X - 10, 150);
            LightView.TabIndex = 66;
            LightView.Visible  = false;

            return(LightView);
        }