Esempio n. 1
0
            /// <summary>
            /// Adds a DataGridViewTextBoxColumn with the given column name and column header text to the collection
            /// </summary>
            /// <returns>The index of the column</returns>
            public int Add(string columnName, string headerText)
            {
                int colnum = _columns.Add(columnName, headerText);

                _columns[colnum].DataPropertyName = columnName;
                return(colnum);
            }
        public void DataGridViewColumnCollection_Add_InvokeColumns_Success()
        {
            using var control = new DataGridView();
            DataGridViewColumnCollection collection = control.Columns;

            using var column1 = new DataGridViewColumn(new SubDataGridViewCell());
            using var column2 = new DataGridViewColumn(new SubDataGridViewCell());

            // Add one.
            collection.Add(column1);
            Assert.Equal(new DataGridViewColumn[] { column1 }, collection.Cast <DataGridViewColumn>());
            Assert.Same(control, column1.DataGridView);
            Assert.Equal(0, column1.Index);
            Assert.Equal(0, column1.DisplayIndex);
            Assert.False(control.IsHandleCreated);

            // Add another.
            collection.Add(column2);
            Assert.Equal(new DataGridViewColumn[] { column1, column2 }, collection.Cast <DataGridViewColumn>());
            Assert.Same(control, column1.DataGridView);
            Assert.Equal(0, column1.Index);
            Assert.Equal(0, column1.DisplayIndex);
            Assert.Same(control, column2.DataGridView);
            Assert.Equal(1, column2.Index);
            Assert.Equal(1, column2.DisplayIndex);
            Assert.False(control.IsHandleCreated);
        }
Esempio n. 3
0
        //加载
        void SetDic(Dictionary <string, string> dic)
        {
            DataGridViewColumnCollection columns = this.dataGridView1.Columns;

            columns.Add("key", "键");
            columns.Add("value", "值");

            foreach (var item in dic)
            {
                DataGridViewRowCollection rows = this.dataGridView1.Rows;
                rows.Add(item.Key, item.Value);
            }
        }
        public void DataGridViewColumnCollection_Add_CustomDisplayIndex_Success(int displayIndex)
        {
            using var control = new DataGridView();
            DataGridViewColumnCollection collection = control.Columns;

            using var column1 = new DataGridViewColumn(new SubDataGridViewCell())
                  {
                      DisplayIndex = displayIndex
                  };
            using var column2 = new DataGridViewColumn(new SubDataGridViewCell())
                  {
                      DisplayIndex = 0
                  };
            using var column3 = new DataGridViewColumn(new SubDataGridViewCell())
                  {
                      DisplayIndex = 1
                  };

            // Add one.
            collection.Add(column1);
            Assert.Equal(new DataGridViewColumn[] { column1 }, collection.Cast <DataGridViewColumn>());
            Assert.Same(control, column1.DataGridView);
            Assert.Equal(0, column1.Index);
            Assert.Equal(0, column1.DisplayIndex);
            Assert.False(control.IsHandleCreated);

            // Add another.
            collection.Add(column2);
            Assert.Equal(new DataGridViewColumn[] { column1, column2 }, collection.Cast <DataGridViewColumn>());
            Assert.Same(control, column1.DataGridView);
            Assert.Equal(0, column1.Index);
            Assert.Equal(1, column1.DisplayIndex);
            Assert.Same(control, column2.DataGridView);
            Assert.Equal(1, column2.Index);
            Assert.Equal(0, column2.DisplayIndex);
            Assert.False(control.IsHandleCreated);

            // Add another.
            collection.Add(column3);
            Assert.Equal(new DataGridViewColumn[] { column1, column2, column3 }, collection.Cast <DataGridViewColumn>());
            Assert.Same(control, column1.DataGridView);
            Assert.Equal(0, column1.Index);
            Assert.Equal(2, column1.DisplayIndex);
            Assert.Same(control, column2.DataGridView);
            Assert.Equal(1, column2.Index);
            Assert.Equal(0, column2.DisplayIndex);
            Assert.Same(control, column3.DataGridView);
            Assert.Equal(2, column3.Index);
            Assert.Equal(1, column3.DisplayIndex);
            Assert.False(control.IsHandleCreated);
        }
        public void DataGridViewColumnCollection_Add_ColumnHasDataGridView_ThrowsInvalidOperationException()
        {
            using var control1 = new DataGridView();
            using var control2 = new DataGridView();
            var collection = new DataGridViewColumnCollection(control1);

            using var column1 = new DataGridViewColumn(new SubDataGridViewCell());
            using var column2 = new DataGridViewColumn(new SubDataGridViewCell());
            control1.Columns.Add(column1);
            control2.Columns.Add(column2);

            Assert.Throws <InvalidOperationException>(() => collection.Add(column1));
            Assert.Throws <InvalidOperationException>(() => collection.Add(column2));
        }
Esempio n. 6
0
        public SpriteEditorForm()
        {
            this.InitializeComponent();
            this.sprites = BBXML.ReadSpriteXML();
            this.sprites_dgv.Rows.Clear();
            this.sprites_dgv.Columns.Clear();
            this.sprites_dgv.Font = new Font("Microsoft Sans Serif", 6.5f, FontStyle.Regular, GraphicsUnit.Point, (byte)0);
            this.sprites_dgv.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
            this.sprites_dgv.AutoGenerateColumns       = false;
            this.sprites_dgv.RowHeadersVisible         = false;
            this.sprites_dgv.MultiSelect = false;
            DataGridViewColumnCollection columns1           = this.sprites_dgv.Columns;
            DataGridViewTextBoxColumn    viewTextBoxColumn1 = new DataGridViewTextBoxColumn();

            viewTextBoxColumn1.HeaderText   = "REF";
            viewTextBoxColumn1.ReadOnly     = true;
            viewTextBoxColumn1.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            viewTextBoxColumn1.FillWeight   = 25f;
            columns1.Add((DataGridViewColumn)viewTextBoxColumn1);
            DataGridViewColumnCollection columns2           = this.sprites_dgv.Columns;
            DataGridViewTextBoxColumn    viewTextBoxColumn2 = new DataGridViewTextBoxColumn();

            viewTextBoxColumn2.HeaderText   = "Name";
            viewTextBoxColumn2.ReadOnly     = true;
            viewTextBoxColumn2.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            viewTextBoxColumn2.FillWeight   = 25f;
            columns2.Add((DataGridViewColumn)viewTextBoxColumn2);
            for (int index = 0; index < this.sprites.Count; ++index)
            {
                this.sprites_dgv.Rows.Add((object)index, (object)this.sprites[index].name);
            }
            this.sprites_dgv.Columns[0].Visible = false;
            this.sprites_dgv.ClearSelection();
        }
        public void DataGridViewColumnCollection_Add_NullDataGridViewColumn_ThrowsArgumentNullException()
        {
            using var control = new DataGridView();
            var collection = new DataGridViewColumnCollection(control);

            Assert.Throws <ArgumentNullException>("dataGridViewColumn", () => collection.Add(null));
        }
Esempio n. 8
0
        public static int Add(this DataGridViewColumnCollection cols, string columnName, string headerText, string toolTipText)
        {
            var col = cols.Add(columnName, headerText);

            cols[col].ToolTipText = toolTipText;
            return(col);
        }
        public void DataGridViewColumnCollection_Add_NoDimensionChangeAllowed_ThrowsInvalidOperationException()
        {
            using var control = new SubDataGridView();
            var collection = new DataGridViewColumnCollection(control);
            int callCount  = 0;

            control.RowValidating += (sender, e) =>
            {
                var column = new DataGridViewColumn(new SubDataGridViewCell());
                Assert.Throws <InvalidOperationException>(() => collection.Add(null));
                Assert.Throws <InvalidOperationException>(() => collection.Add(column));
                callCount++;
            };
            control.OnRowValidating(null);
            Assert.Equal(1, callCount);
        }
Esempio n. 10
0
        public CharacterHeadChangeForm(List <Sprite> sprites_)
        {
            this.InitializeComponent();
            this.sprites = sprites_;
            this.dgv_heads.Rows.Clear();
            this.dgv_heads.Columns.Clear();
            this.dgv_heads.Font = new Font("Microsoft Sans Serif", 6.5f, FontStyle.Regular, GraphicsUnit.Point, (byte)0);
            this.dgv_heads.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
            this.dgv_heads.AutoGenerateColumns       = false;
            this.dgv_heads.RowHeadersVisible         = false;
            this.dgv_heads.MultiSelect = false;
            DataGridViewColumnCollection columns1           = this.dgv_heads.Columns;
            DataGridViewTextBoxColumn    viewTextBoxColumn1 = new DataGridViewTextBoxColumn();

            viewTextBoxColumn1.HeaderText   = "ID";
            viewTextBoxColumn1.ReadOnly     = true;
            viewTextBoxColumn1.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            viewTextBoxColumn1.FillWeight   = 25f;
            columns1.Add((DataGridViewColumn)viewTextBoxColumn1);
            DataGridViewColumnCollection columns2           = this.dgv_heads.Columns;
            DataGridViewTextBoxColumn    viewTextBoxColumn2 = new DataGridViewTextBoxColumn();

            viewTextBoxColumn2.HeaderText   = "Name";
            viewTextBoxColumn2.ReadOnly     = true;
            viewTextBoxColumn2.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            viewTextBoxColumn2.FillWeight   = 25f;
            columns2.Add((DataGridViewColumn)viewTextBoxColumn2);
            for (int index = 0; index < this.sprites.Count; ++index)
            {
                this.dgv_heads.Rows.Add((object)("0x" + this.sprites[index].id.ToString("x")), (object)this.sprites[index].name);
            }
        }
Esempio n. 11
0
        private void Form1_Load(object sender, EventArgs e)
        {
            DataGridViewColumnCollection columns = dgvStudents.Columns;

            columns.Add(DataGridColumnFactory.TextColumnStyle("FirstName", "FirstName"));
            columns.Add(DataGridColumnFactory.TextColumnStyle("LastName", "LastName"));

            BindingSource bs = new BindingSource();

            bs.DataSource = Student.getStudents();

            dgvStudents.DataSource = bs;
            dgvStudents.Dock       = DockStyle.Fill;

            //Agregar la grilla
            this.Controls.Add(dgvStudents);
            dgvStudents.SetChild();
        }
Esempio n. 12
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="columns"></param>
 /// <param name="property"></param>
 public static void AddDataBoundColumn(this DataGridViewColumnCollection columns, string property)
 {
     columns.Add(new DataGridViewTextBoxColumn
     {
         DataPropertyName = property,
         HeaderText       = property,
         Name             = property,
     });
 }
        public void DataGridViewColumnCollection_Add_CustomAutoSizeMode_Success(bool columnHeadersVisible, bool visible, bool frozen, DataGridViewAutoSizeColumnsMode columnsAutoSizeMode, DataGridViewAutoSizeColumnMode autoSizeMode)
        {
            using var control = new DataGridView
                  {
                      AutoSizeColumnsMode  = columnsAutoSizeMode,
                      ColumnHeadersVisible = columnHeadersVisible
                  };
            DataGridViewColumnCollection collection = control.Columns;

            using var column1 = new DataGridViewColumn(new SubDataGridViewCell())
                  {
                      AutoSizeMode = autoSizeMode,
                      Frozen       = frozen,
                      Visible      = visible
                  };
            using var column2 = new DataGridViewColumn(new SubDataGridViewCell())
                  {
                      AutoSizeMode = autoSizeMode,
                      Frozen       = frozen,
                      Visible      = visible
                  };

            // Add one.
            collection.Add(column1);
            Assert.Equal(new DataGridViewColumn[] { column1 }, collection.Cast <DataGridViewColumn>());
            Assert.Same(control, column1.DataGridView);
            Assert.Equal(0, column1.Index);
            Assert.Equal(0, column1.DisplayIndex);
            Assert.False(control.IsHandleCreated);

            // Add another.
            collection.Add(column2);
            Assert.Equal(new DataGridViewColumn[] { column1, column2 }, collection.Cast <DataGridViewColumn>());
            Assert.Same(control, column1.DataGridView);
            Assert.Equal(0, column1.Index);
            Assert.Equal(0, column1.DisplayIndex);
            Assert.Same(control, column2.DataGridView);
            Assert.Equal(1, column2.Index);
            Assert.Equal(1, column2.DisplayIndex);
            Assert.False(control.IsHandleCreated);
        }
Esempio n. 14
0
        private DataGridViewColumnCollection CreateColumn(DataColumnCollection clms, DataGridView grdv)
        {
            DataGridViewColumnCollection clmsNew = new DataGridViewColumnCollection(grdv);

            foreach (DataColumn col in clms)
            {
                DataGridViewColumn grdcol = new DataGridViewColumn();
                grdcol.HeaderText = col.ColumnName;
                clmsNew.Add(grdcol);
            }

            return(clmsNew);
        }
        public void DataGridViewColumnCollection_Add_InDisplayIndexAdjustment_ThrowsInvalidOperationException()
        {
            using var control = new DataGridView();
            var collection = new DataGridViewColumnCollection(control);

            using var column1 = new DataGridViewColumn(new SubDataGridViewCell());
            using var column2 = new DataGridViewColumn(new SubDataGridViewCell());
            control.Columns.Add(column1);
            control.Columns.Add(column2);

            int callCount = 0;

            control.ColumnDisplayIndexChanged += (sender, e) =>
            {
                var column = new DataGridViewColumn(new SubDataGridViewCell());
                Assert.Throws <InvalidOperationException>(() => collection.Add(null));
                Assert.Throws <InvalidOperationException>(() => collection.Add(column));
                callCount++;
            };
            column1.DisplayIndex = 1;
            Assert.Equal(2, callCount);
        }
        public void DataGridViewColumnCollection_Add_ColumnAutomaticSortModeColumnSelectionMode_ThrowsInvalidOperationException(DataGridViewSelectionMode selectionMode)
        {
            using var control = new DataGridView
                  {
                      SelectionMode = selectionMode
                  };
            var collection = new DataGridViewColumnCollection(control);

            using var column = new DataGridViewColumn(new SubDataGridViewCell())
                  {
                      SortMode = DataGridViewColumnSortMode.Automatic
                  };
            Assert.Throws <InvalidOperationException>(() => collection.Add(column));
        }
Esempio n. 17
0
        public static Int32 Add(this DataGridViewColumnCollection lst, String columnName, String headerText, String dataPropertyName, Int32 width, Boolean visible, String format)
        {
            Int32 rs = lst.Add(columnName, headerText);
            DataGridViewColumn col = lst[lst.Count - 1];

            col.DataPropertyName = dataPropertyName;
            col.Visible          = visible;
            col.Width            = width;
            if (!String.IsNullOrEmpty(format))
            {
                col.DefaultCellStyle.Format = format;
            }
            return(rs);
        }
        public void DataGridViewColumnCollection_Add_CustomColumnSortModeAndSelectionMode_Success(DataGridViewSelectionMode selectionMode, DataGridViewColumnSortMode sortMode)
        {
            using var control = new DataGridView
                  {
                      SelectionMode = selectionMode
                  };
            DataGridViewColumnCollection collection = control.Columns;

            using var column1 = new DataGridViewColumn(new SubDataGridViewCell())
                  {
                      SortMode = sortMode
                  };
            using var column2 = new DataGridViewColumn(new SubDataGridViewCell())
                  {
                      SortMode = sortMode
                  };

            // Add one.
            collection.Add(column1);
            Assert.Equal(new DataGridViewColumn[] { column1 }, collection.Cast <DataGridViewColumn>());
            Assert.Same(control, column1.DataGridView);
            Assert.Equal(0, column1.Index);
            Assert.Equal(0, column1.DisplayIndex);
            Assert.False(control.IsHandleCreated);

            // Add another.
            collection.Add(column2);
            Assert.Equal(new DataGridViewColumn[] { column1, column2 }, collection.Cast <DataGridViewColumn>());
            Assert.Same(control, column1.DataGridView);
            Assert.Equal(0, column1.Index);
            Assert.Equal(0, column1.DisplayIndex);
            Assert.Same(control, column2.DataGridView);
            Assert.Equal(1, column2.Index);
            Assert.Equal(1, column2.DisplayIndex);
            Assert.False(control.IsHandleCreated);
        }
        public static void AddRange(this DataGridViewColumnCollection collection,
                                    IEnumerable <DataGridViewColumn> columns)
        {
            if (collection == null)
            {
                throw new ArgumentNullException(nameof(collection));
            }
            if (columns == null)
            {
                throw new ArgumentNullException(nameof(columns));
            }

            foreach (var column in columns)
            {
                collection.Add(column);
            }
        }
Esempio n. 20
0
        //---------------------------------------------------------------------
        public void AddColumn(DataGridViewColumn column, Func <TModel, TValue> predicate = null)
        {
            if (column == null)
            {
                throw new ArgumentNullException(nameof(column));
            }
            if (_columns.Contains(column))
            {
                throw new ArgumentException(string.Empty, nameof(column));
            }

            _columns.Add(column);

            if (predicate != null)
            {
                _cacheColumnIndexes.Add(column.Index, predicate);
            }
        }
Esempio n. 21
0
        private void agregarColumnasCombos()
        {
            // DGV Actual
            // Obtenemos la colección de columnas...
            DataGridViewColumnCollection columnas = dgvCalificacionesActuales.Columns;

            // Agrego a la tabla, los combos de A NP NA RV R
            DataGridViewComboBoxColumn columna1 = new DataGridViewComboBoxColumn()
            {
                Name = "tipoDeAcreditacion1"
            };

            columna1.DataSource = calificaciones_semestrales.tiposDeAcreditacion.ToList();
            columna1.Visible    = false;

            dgvCalificacionesActuales.Columns.Add(columna1);

            // DGV Siseems
            // Obtenemos la colección de columnas...
            columnas = dgvCalificacionesSiseems.Columns;

            // Agrego a la tabla, los combos de A NP NA RV R
            DataGridViewComboBoxColumn columna2 = new DataGridViewComboBoxColumn()
            {
                Name = "tipoDeAcreditacion1"
            };

            columna2.DataSource = calificaciones_semestrales.tiposDeAcreditacion.ToList();
            columna2.Visible    = false;

            dgvCalificacionesSiseems.Columns.Add(columna2);

            // Esta siguiente columna es para decidir si
            // agregamos las modificaciones a la base de datos

            DataGridViewCheckBoxColumn columna3 = new DataGridViewCheckBoxColumn()
            {
                Name = "actualizar", HeaderText = "Actualizar"
            };

            columna3.Visible = false;
            columnas.Add(columna3);
        }
        public void DataGridViewColumnCollection_AddWithHeaderCell_Invoke_Success()
        {
            using var control = new DataGridView();
            DataGridViewColumnCollection collection = control.Columns;

            using var headerCell = new DataGridViewColumnHeaderCell();
            using var column     = new DataGridViewColumn(new SubDataGridViewCell())
                  {
                      HeaderCell = headerCell
                  };

            // Add one.
            collection.Add(column);
            Assert.Same(control, column.DataGridView);
            Assert.Equal(0, column.Index);
            Assert.Equal(0, column.DisplayIndex);
            Assert.Same(control, headerCell.DataGridView);
            Assert.False(control.IsHandleCreated);
        }
        public void DataGridViewColumnCollection_Add_ColumnAutomaticSortModeColumnSelectionModeInInitialization_ThrowsInvalidOperationException(DataGridViewSelectionMode selectionMode)
        {
            using var control = new DataGridView
                  {
                      SelectionMode = selectionMode
                  };
            ISupportInitialize           iSupportInitialize = (ISupportInitialize)control;
            DataGridViewColumnCollection collection         = control.Columns;

            using var column = new DataGridViewColumn(new SubDataGridViewCell())
                  {
                      SortMode = DataGridViewColumnSortMode.Automatic
                  };
            iSupportInitialize.BeginInit();
            collection.Add(column);

            // End init.
            Assert.Throws <InvalidOperationException>(() => iSupportInitialize.EndInit());
            Assert.Equal(DataGridViewSelectionMode.RowHeaderSelect, control.SelectionMode);
        }
        private void augmentGrid()
        {
            DataGridView grid = this.childItems.Grid;

            grid.ReadOnly = false;

            DataGridViewColumnCollection cols = grid.Columns;

            IEnumerator colEnumer = cols.GetEnumerator();

            DataGridViewColumn col;

            while (colEnumer.MoveNext())
            {
                col          = (DataGridViewColumn)colEnumer.Current;
                col.ReadOnly = true;
            }

            cols.Add(Properties.Resources.StringsGrade, Properties.Resources.StringsGrade);

            grid.CellLeave += new DataGridViewCellEventHandler(HandleGradeUpdate);
            grid.KeyUp     += new KeyEventHandler(HandleGradeUpdateByKey);
        }
Esempio n. 25
0
#pragma warning restore IDE1006 // Naming Styles

        #region Private methods
        private void AddColumns()
        {
            mainDataGridView.DataSource = null;
            mainDataGridView.Columns.Clear();

            DataGridViewColumnCollection columns = mainDataGridView.Columns;

            Type type = searchResult.ItemType;

            foreach (string name in searcher.Columns.Selected)
            {
                PropertyInfo property     = ColumnSet.GetProperty(type, name);
                Type         propertyType = property.PropertyType;

                columns.Add(new DataGridViewTextBoxColumn
                {
                    DataPropertyName = name,
                    HeaderText       = name,
                    Name             = name,
                    ValueType        = property.PropertyType,
                    Tag = property
                });
            }

            mainDataGridView.DataSource = searchResult.DataSource;

            foreach (DataGridViewColumn column in columns)
            {
                int width = column.Width;
                column.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
                column.Width        = width;
            }

            mainTabControl.SelectedTab = listTabPage;
            EnableUI(true);
        }
Esempio n. 26
0
        public static void configColumns(DataGridView grid, Type tipo)
        {
            DataGridViewColumnCollection columns = grid.Columns;



            if (tipo == typeof(Qualifications))
            {
                //grid.AutoGenerateColumns = true;
                columns.Add(DataGridColumnFactory.IntegerColumnStyle("Id", "Id"));
                columns.Add(DataGridColumnFactory.IntegerColumnStyle("Nota1", "Nota1"));
                columns.Add(DataGridColumnFactory.IntegerColumnStyle("Nota2", "Nota2"));
            }
            else if (tipo == typeof(Course))
            {
                columns.Add(DataGridColumnFactory.IntegerColumnStyle("Credits", "Credits"));
                columns.Add(DataGridColumnFactory.TextColumnStyle("Subject", "Subject"));
                columns.Add(DataGridColumnFactory.TextColumnStyle("Teacher", "Teacher"));
            }
        }
        private void InitializeRequestColumns(DataGridViewColumnCollection columns)
        {
            DataGridViewColumn    column;
            DataGridViewCellStyle style;

            //
            //Index
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "Id";
            column.HeaderText       = "Id";
            column.Name             = "clmRequestId";
            column.Width            = 40;
            //
            //Request
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "Request";
            column.HeaderText       = "Request";
            column.Name             = "clmRequest";
            column.Width            = 150;
            //
            //RequestType
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "RequestType";
            column.HeaderText       = "Type";
            column.Name             = "plainClmRequestType";
            column.Width            = 70;
            //
            //IP
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "IP";
            column.HeaderText       = "IP";
            column.Name             = "clmIP";
            column.Width            = 80;
            //
            // Start
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            style                   = new DataGridViewCellStyle();
            style.Format            = "MMM dd, HH:mm:ss.fff";
            column.DataPropertyName = "StartDate";
            column.DefaultCellStyle = style;
            column.HeaderText       = "Start";
            column.Name             = "clmStart";
            column.Width            = 110;
            //
            // clmFinish
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            style                   = new DataGridViewCellStyle();
            style.Format            = "HH:mm:ss.fff";
            column.DataPropertyName = "FinishDate";
            column.DefaultCellStyle = style;
            column.HeaderText       = "Finish";
            column.Name             = "clmFinish";
            column.Visible          = false;
            column.Width            = 75;
            //
            // clmTotalTime
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            style                   = new DataGridViewCellStyle();
            style.Alignment         = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            style.Format            = Constants.COLUMNS.TOTAL_TIME_FORMAT;
            column.DataPropertyName = Constants.COLUMNS.TOTAL_TIME_PROPERTY_NAME;
            column.DefaultCellStyle = style;
            column.HeaderText       = "Total time";
            column.Name             = "clmTotalTime";
            column.Width            = 80;
            //
            // clmConnectId
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "ConnectId";
            column.HeaderText       = "ConnectId";
            column.Name             = "clmConnectId";
            column.Visible          = false;
            column.Width            = 70;
            //
            // clmLoginId
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "LoginId";
            column.HeaderText       = "LoginId";
            column.Name             = "clmLoginId";
            column.Visible          = false;
            column.Width            = 70;
            //
            // clmCallId
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "CallId";
            column.HeaderText       = "CallId";
            column.Name             = "clmCallId";
            column.Visible          = false;
            column.Width            = 70;
            //
            // clmUserName
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "User";
            column.HeaderText       = "User";
            column.Name             = "clmUserName";
            column.Visible          = false;
            column.Width            = 70;
            //
            // clmThreadName
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "Thread";
            column.HeaderText       = "Thread";
            column.Name             = "clmThreadName";
            column.Visible          = false;
        }
Esempio n. 28
0
        private void SetColumns(DataGridViewColumnCollection columns)
        {
            DataGridViewColumn    column;
            DataGridViewCellStyle style;

            //
            //Index
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "Id";
            column.HeaderText       = "Id";
            column.Name             = "plainClmRequestId";
            column.Width            = 40;
            //
            // clmRowIndex
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "ParentId";
            column.HeaderText       = "RequestId";
            column.Name             = "plainClmRequestId";
            column.Width            = 70;
            //
            //Request
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "Request";
            column.HeaderText       = "Request";
            column.Name             = "plainClmRequest";
            column.Width            = 150;
            //
            //RequestType
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "RequestType";
            column.HeaderText       = "Type";
            column.Name             = "plainClmRequestType";
            column.Width            = 70;
            //
            // DB Start DateTime
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            style                   = new DataGridViewCellStyle();
            style.Format            = "MMM dd, HH:mm:ss.fff";
            column.DataPropertyName = "DbStartDate";
            column.DefaultCellStyle = style;
            column.HeaderText       = "DB Start";
            column.Name             = "plainClmDbStart";
            column.Width            = 110;
            //
            // Start
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            style                   = new DataGridViewCellStyle();
            style.Format            = "MMM dd, HH:mm:ss.fff";
            column.DataPropertyName = "StartDate";
            column.DefaultCellStyle = style;
            column.HeaderText       = "Start";
            column.Name             = "plainClmStart";
            column.Width            = 110;
            //
            //IP
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "IP";
            column.HeaderText       = "IP";
            column.Name             = "plainClmIP";
            column.Width            = 80;
            //
            // clmConnectId
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "ConnectId";
            column.HeaderText       = "ConnectId";
            column.Name             = "plainClmConnectId";
            column.Width            = 70;
            //
            // clmLoginId
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "LoginId";
            column.HeaderText       = "LoginId";
            column.Name             = "plainClmLoginId";
            column.Width            = 70;
            //
            // clmCallId
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "CallId";
            column.HeaderText       = "CallId";
            column.Name             = "plainClmCallId";
            column.Width            = 70;
            //
            // clmUserName
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "User";
            column.HeaderText       = "User";
            column.Name             = "plainClmUserName";
            column.Width            = 70;
            //
            // clmThreadName
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "Thread";
            column.HeaderText       = "Thread";
            column.Name             = "plainClmThreadName";
            //
            // clmType
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "Type";
            column.HeaderText       = "Type";
            column.Name             = "plainClmType";
            column.Width            = 40;
            //
            // clmExecutionTime
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            style                   = new DataGridViewCellStyle();
            style.Alignment         = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            column.DataPropertyName = "DbTime";
            column.DefaultCellStyle = style;
            column.HeaderText       = "DbTime(ms)";
            column.Name             = "plainClmDbTime";
            column.Width            = 80;
            //
            // clmRowAffected
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            style                   = new DataGridViewCellStyle();
            style.Alignment         = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            column.DataPropertyName = "RowAffected";
            column.DefaultCellStyle = style;
            column.HeaderText       = "Affected rows";
            column.Name             = "plainClmRowAffected";
            //
            // clmSchema
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "DbSchema";
            column.HeaderText       = "DbSchema";
            column.Name             = "plainClmSchema";
            //
            // clmContainsSQL
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "ContainsSQL";
            column.HeaderText       = "SQL";
            column.Name             = "plainClmContainsSQL";
            column.Visible          = false;
            //
            // clmMethod
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "Method";
            column.HeaderText       = "Method";
            column.Name             = "plainClmMethod";
            column.Width            = 350;
            //
            // clmMessage
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "Message";
            column.HeaderText       = "Message";
            column.Name             = "plainClmMessage";
        }
Esempio n. 29
0
        public void InitializeTable()
        {
            dataGridView.AllowUserToAddRows    = false;
            dataGridView.AllowUserToDeleteRows = false;

            dataGridView.CellValidating += CellValidatingHandler;
            dataGridView.CellValidated  += CellValidatedHandler;

            DataGridViewColumnCollection columns = dataGridView.Columns;
            DataGridViewColumn           column;
            DataGridViewTextBoxCell      template = new DataGridViewTextBoxCell();

            column      = new DataGridViewColumn(template);
            column.Name = column.HeaderText = "Name";
            columns.Add(column);

            column      = new DataGridViewColumn(template);
            column.Name = column.HeaderText = "ModelName";
            columns.Add(column);

            column             = new DataGridViewColumn(template);
            column.Name        = column.HeaderText = "ThinkParamID";
            column.ToolTipText = "Controls enemy AI";
            column.ValueType   = typeof(int);
            columns.Add(column);

            column             = new DataGridViewColumn(template);
            column.Name        = column.HeaderText = "NPCParamID";
            column.ToolTipText = "Controls enemy stats";
            column.ValueType   = typeof(int);
            columns.Add(column);

            column             = new DataGridViewColumn(template);
            column.Name        = column.HeaderText = "EventEntityID";
            column.ToolTipText = "Used to identify the part in event scripts";
            column.ValueType   = typeof(int);
            columns.Add(column);

            column             = new DataGridViewColumn(template);
            column.Name        = column.HeaderText = "TalkID";
            column.ToolTipText = "Controls enemy speech";
            column.ValueType   = typeof(int);
            columns.Add(column);

            column             = new DataGridViewColumn(template);
            column.Name        = column.HeaderText = "CharaInitID";
            column.ToolTipText = "Controls enemy equipment";
            column.ValueType   = typeof(int);
            columns.Add(column);

            column      = new DataGridViewColumn(template);
            column.Name = column.HeaderText = "Position";
            columns.Add(column);

            column      = new DataGridViewColumn(template);
            column.Name = column.HeaderText = "Rotation";
            columns.Add(column);

            column          = new DataGridViewColumn(template);
            column.Name     = column.HeaderText = "Description";
            column.ReadOnly = true;
            columns.Add(column);

            dataGridView.AutoResizeColumns();
        }
        private void InitializeSubRequestColumns(DataGridViewColumnCollection columns)
        {
            DataGridViewColumn    column;
            DataGridViewCellStyle style;

            //
            // clmRowIndex
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "Id";
            column.HeaderText       = "Id";
            column.Name             = "clmRowId";
            column.Width            = 50;
            //
            // clmType
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "Type";
            column.HeaderText       = "Type";
            column.Name             = "clmType";
            column.Visible          = false;
            column.Width            = 40;
            //
            // clmDate
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            style                   = new DataGridViewCellStyle();
            style.Format            = "HH:mm:ss.fff";
            column.DataPropertyName = "StartDate";
            column.DefaultCellStyle = style;
            column.HeaderText       = "Begin time";
            column.Name             = "clmDate";
            column.Visible          = false;
            column.Width            = 80;
            //
            // DB Start DateTime
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            style                   = new DataGridViewCellStyle();
            style.Format            = "HH:mm:ss.fff";
            column.DataPropertyName = "DbStartDate";
            column.DefaultCellStyle = style;
            column.HeaderText       = "DB Start";
            column.Name             = "plainClmDbStart";
            column.Width            = 110;
            //
            // clmDbTime
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            style                   = new DataGridViewCellStyle();
            style.Alignment         = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            column.DataPropertyName = "DbTime";
            column.DefaultCellStyle = style;
            column.HeaderText       = "DB Time(ms)";
            column.Name             = "clmDbTime";
            column.Width            = 120;
            //
            // clmTotalTime
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            style                   = new DataGridViewCellStyle();
            style.Format            = Constants.COLUMNS.TOTAL_TIME_FORMAT;
            style.Alignment         = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            column.DataPropertyName = Constants.COLUMNS.TOTAL_TIME_PROPERTY_NAME;
            column.DefaultCellStyle = style;
            column.HeaderText       = "Total Time";
            column.Name             = "clmTotalTime";
            column.Width            = 100;
            //
            // clmRowAffected
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            style                   = new DataGridViewCellStyle();
            style.Alignment         = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            column.DataPropertyName = "RowAffected";
            column.DefaultCellStyle = style;
            column.HeaderText       = "Affected rows";
            column.Name             = "clmRowAffected";
            column.Visible          = false;
            //
            // clmMethod
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "Method";
            column.HeaderText       = "Method";
            column.Name             = "clmMethod";
            column.Width            = 350;
            //
            // clmSchema
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "DbSchema";
            column.HeaderText       = "DbSchema";
            column.Name             = "clmSchema";
            column.Visible          = false;
            //
            // clmContainsSQL
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "ContainsSQL";
            column.HeaderText       = "SQL";
            column.Name             = "clmContainsSQL";
            column.Visible          = false;
            //
            // clmMessage
            //
            column = new DataGridViewTextBoxColumn();
            columns.Add(column);
            column.DataPropertyName = "Message";
            column.HeaderText       = "Message";
            column.Name             = "clmMessage";
            column.Visible          = false;
        }