private void dataGridView_ColumnRemoved(object sender, DataGridViewColumnEventArgs e) { if ((e.Column != null) && !e.Column.IsDataBound) { e.Column.DisplayIndex = -1; } }
protected override void OnColumnAdded(DataGridViewColumnEventArgs e) { base.OnColumnAdded(e); e.Column.HeaderCell.ContextMenuStrip = menuColumnHeader; MenuOpening(null, new CancelEventArgs()); }
void keyDataGridView_ColumnAdded(object sender, DataGridViewColumnEventArgs e) { e.Column.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; if (e.Column.DataPropertyName == "Confirm" || e.Column.DataPropertyName == "Lifetime") { e.Column.Visible = false; } }
private void grdFilter_ColumnWidthChanged(object sender, System.Windows.Forms.DataGridViewColumnEventArgs e) { if (!m_raisedFromEvent) { ResizeFilterTextBoxes(grdFilter, grdCU); } }
private void grdFilter_ColumnWidthChanged(object sender, System.Windows.Forms.DataGridViewColumnEventArgs e) { if (!m_bSystemIsResizingColumns) { ResizeFilterTextBoxes(grdFilter, grdCU, grdSelected); } }
private void StyledDataGridView_ColumnWidthChanged(object sender, System.Windows.Forms.DataGridViewColumnEventArgs e) { if (ColumnSettingsManager != null) { ColumnSettingsManager.ColumnWidthChanged(this, e); } }
protected override void OnColumnAdded(System.Windows.Forms.DataGridViewColumnEventArgs e) { base.OnColumnAdded(e); if (_DGVHasTransparentBackground) { SetCellStyle(Color.Transparent); } }
private void dgv_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e) { int index = dgv.Columns.IndexOf(e.Column); if (index == -1) return; var col = _schema[index]; col.Width = e.Column.Width; }
//Makes the print column selectable, and keeps other columns readonly private void AuditGridView_ColumnAdded(object sender, DataGridViewColumnEventArgs e) { DataGridViewColumn column = e.Column; column.ReadOnly = true; if (column.Name == "print") { column.ReadOnly = false; } }
/// <summary> /// 列の幅が変更されたとき /// </summary> /// <param name="e"></param> /// <remarks></remarks> protected override void OnColumnWidthChanged(System.Windows.Forms.DataGridViewColumnEventArgs e) { base.OnColumnWidthChanged(e); try { InvalidateUnitColumns(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void connectionsDataGridView_ColumnDisplayIndexChanged(object sender, DataGridViewColumnEventArgs e) { if (!m_start) { m_Settings["connectionsIconIndex"] = connectionsDataGridView.Columns["Icon"].DisplayIndex.ToString(); m_Settings["connectionsIPAddressIndex"] = connectionsDataGridView.Columns["IPAddress"].DisplayIndex.ToString(); m_Settings["connectionsPortIndex"] = connectionsDataGridView.Columns["Port"].DisplayIndex.ToString(); m_Settings["connectionsSentIndex"] = connectionsDataGridView.Columns["Sent"].DisplayIndex.ToString(); m_Settings["connectionsReceivedIndex"] = connectionsDataGridView.Columns["Received"].DisplayIndex.ToString(); m_Settings["connectionsSentCommandsIndex"] = connectionsDataGridView.Columns["SentCommands"].DisplayIndex.ToString(); m_Settings["connectionsReceivedCommandsIndex"] = connectionsDataGridView.Columns["ReceivedCommands"].DisplayIndex.ToString(); m_Settings["connectionsEnqueuedCommandsIndex"] = connectionsDataGridView.Columns["EnqueuedCommands"].DisplayIndex.ToString(); } }
void SpreadsheetView_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e) { int col = e.Column.Index; SpreadsheetModel model = spreadsheetModel; for (int i = 0; i < RowCount; i++) { Cell cell = model.Cells[i, col]; if (cell == null) { cell = new Cell(); model.Cells[i,col] = cell; } cell.CellFormat.CellWidth = this.Columns[col].Width; } }
void ActiveSessionList_ColumnAdded(object sender, System.Windows.Forms.DataGridViewColumnEventArgs e) { if (e.Column.Name == "session_name") { e.Column.Width = 180 * scale_x; } else if (e.Column.Name == "bingoday") { e.Column.Width = 90 * scale_x; } else if (e.Column.Name == "session_order") { e.Column.Width = 60 * scale_x; e.Column.HeaderText = "Number"; } else { e.Column.Visible = false; } }
private void OnColumnPostRemovedInternal (DataGridViewColumnEventArgs e) { if (e.Column.CellTemplate != null) { int index = e.Column.Index; foreach (DataGridViewRow row in Rows) row.Cells.RemoveAt (index); } AutoResizeColumnsInternal (); PrepareEditingRow (false, true); OnColumnRemoved (e); }
internal void OnColumnPreRemovedInternal (DataGridViewColumnEventArgs e) { // The removed column should be removed from the selection too. if (selected_columns != null) SetSelectedColumnCore (e.Column.Index, false); if (Columns.Count - 1 == 0) { MoveCurrentCell (-1, -1, true, false, false, true); rows.ClearInternal (); } else if (currentCell != null && CurrentCell.ColumnIndex == e.Column.Index) { int nextColumnIndex = e.Column.Index; if (nextColumnIndex >= Columns.Count - 1) nextColumnIndex = Columns.Count - 1 - 1; MoveCurrentCell (nextColumnIndex, currentCell.RowIndex, true, false, false, true); if (hover_cell != null && hover_cell.ColumnIndex >= e.Column.Index) hover_cell = null; } }
private void ScannerViewColumnWidthChanged(object sender, DataGridViewColumnEventArgs e) { ScannerViewUpdateHeaderCheckBoxPos(); }
private void fDataPreview_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e) { if (this.checkColumnsWidth && fDataPreview.Columns.Count > 0) { if (!this.justUpdated) { int width = fDataPreview.Columns.GetColumnsWidth(DataGridViewElementStates.Visible); if (width < 682) { this.justUpdated = true; fDataPreview.Columns[fDataPreview.Columns.Count - 1].Width += 682 - width; } } else { this.justUpdated = false; } } }
/// <summary> /// Throws an exception when the column sort mode is changed to Automatic. /// </summary> /// <param name="sender">The object that raised the event.</param> /// <param name="e">A DataGridViewColumnEventArgs that contains the event data.</param> private void DataGridView_ColumnSortModeChanged(object sender, DataGridViewColumnEventArgs e) { if (e.Column == OwningColumn && e.Column.SortMode == DataGridViewColumnSortMode.Automatic) { throw new InvalidOperationException( "A SortMode value of Automatic is incompatible with " + "the DataGridViewAutoFilterColumnHeaderCell type. " + "Use the AutomaticSortingEnabled property instead."); } }
private void dgvcallups_ColumnAdded(object sender, DataGridViewColumnEventArgs e) { //if (e.Column.Index == 9) //{ // _coladded = true; // dgvcallups.Rows[_newAddedRowIndex].Cells[1].Value = " "; // dgvcallups.Rows[_newAddedRowIndex].Cells[2].Value = " "; // dgvcallups.Rows[_newAddedRowIndex].Cells[3].Value = " "; // dgvcallups.Rows[_newAddedRowIndex].Cells[4].Value = " "; // dgvcallups.Rows[_newAddedRowIndex].Cells[5].Value = false; // dgvcallups.Rows[_newAddedRowIndex].Cells[6].Value = false; // dgvcallups.Rows[_newAddedRowIndex].Cells[7].Value = false; // dgvcallups.Rows[_newAddedRowIndex].Cells[8].Value = ""; // dgvcallups.Rows[_newAddedRowIndex].Cells[9].Value = true; // dgvcallups.RefreshEdit(); // dgvcallups.Refresh(); //} }
// 列のサイズ変更関連 private void ShipView_ColumnWidthChanged( object sender, DataGridViewColumnEventArgs e ) { if ( IsRowsUpdating ) return; var group = CurrentGroup; if ( group != null ) { if ( !group.ViewColumns[e.Column.Name].AutoSize ) { group.ViewColumns[e.Column.Name].Width = e.Column.Width; } } }
/// <summary> /// 当DataGridView的列顺序改变时,同时改变合计行的列序号 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void dgv_ColumnDisplayIndexChanged(object sender, DataGridViewColumnEventArgs e) { if (this.dgv.Columns.Count != dgvSum.Columns.Count) return; this.dgvSum.Columns[e.Column.Index].DisplayIndex = e.Column.DisplayIndex; }
/// <summary> /// 当改变dataGridView的列宽时,合计的列宽也跟随改变 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void dgv_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e) { this.dgv.HorizontalScrollingOffset = this.dgvSum.HorizontalScrollingOffset; this.dgvSum.Columns[e.Column.Index].Width = e.Column.Width; //if (IsShowScroll(this.dgvSum)) //{ // //if (this.dgvSum.Height != ROW_HEIGHT + 20) // //this.dgvSum.Height = ROW_HEIGHT + 20; // this.dgv.Height -= 20; //} //else //{ // //if (this.dgvSum.Height != ROW_HEIGHT) // //this.dgvSum.Height = ROW_HEIGHT; // this.dgv.Height += 20; //} SetDataGridViewLocation(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Raises the <see cref="E:System.Windows.Forms.DataGridView.ColumnWidthChanged"/> /// event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.DataGridViewColumnEventArgs"/> /// that contains the event data.</param> /// <exception cref="T:System.ArgumentException">The column indicated by the /// <see cref="P:System.Windows.Forms.DataGridViewColumnEventArgs.Column"/> property of /// e does not belong to this <see cref="T:System.Windows.Forms.DataGridView"></see> /// control.</exception> /// ------------------------------------------------------------------------------------ protected override void OnColumnWidthChanged(DataGridViewColumnEventArgs e) { base.OnColumnWidthChanged(e); if (e.Column.Width == DataGridViewControlColumn.kMinimumValue && m_fFullyInitialized && ((DataGridViewControlColumn)e.Column).IsCollapsible) { // user dragged the divider all the way to the left, so we will hide the column m_ColumnsAndRowsToHide.Add(e.Column); } }
/************************************************************* * データグリッドビュー(ヘッダー)の列幅変更に伴う処理 *************************************************************/ private new void dataGridViewHeader_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e) { base.DataGridView = this.dataGridView; base.DataGridViewTotal = this.dataGridViewTotal; base.DataGridViewHeader = this.dataGridViewHeader; base.dataGridViewHeader_ColumnWidthChanged(sender, e); }
protected virtual void OnColumnRemoved (DataGridViewColumnEventArgs e) { DataGridViewColumnEventHandler eh = (DataGridViewColumnEventHandler)(Events [ColumnRemovedEvent]); if (eh != null) eh (this, e); }
protected internal virtual void OnColumnWidthChanged (DataGridViewColumnEventArgs e) { DataGridViewColumnEventHandler eh = (DataGridViewColumnEventHandler)(Events [ColumnWidthChangedEvent]); if (eh != null) eh (this, e); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Called when the width of the column changed. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewColumnEventArgs"/> /// instance containing the event data.</param> /// ------------------------------------------------------------------------------------ internal void OnColumnWidthChanged(object sender, DataGridViewColumnEventArgs e) { if (e.Column != OwningColumn || RowIndex < 0 || ColumnIndex < 0 || m_Control == null) return; UpdateControlBounds(); }
private void _dataGrid_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e) { ClearDrawCache(); }
private void sharedFilesDataGridView_ColumnDisplayIndexChanged(object sender, DataGridViewColumnEventArgs e) { if (!m_start) { m_Settings["sharedIconIndex"] = sharedFilesDataGridView.Columns["Icon"].DisplayIndex.ToString(); m_Settings["sharedRatingIconIndex"] = sharedFilesDataGridView.Columns["RatingIcon"].DisplayIndex.ToString(); m_Settings["sharedFileNameIndex"] = sharedFilesDataGridView.Columns["FileName"].DisplayIndex.ToString(); m_Settings["sharedFileSizeIndex"] = sharedFilesDataGridView.Columns["FileSize"].DisplayIndex.ToString(); m_Settings["sharedDirectoryIndex"] = sharedFilesDataGridView.Columns["Directory"].DisplayIndex.ToString(); m_Settings["sharedAlbumIndex"] = sharedFilesDataGridView.Columns["Album"].DisplayIndex.ToString(); m_Settings["sharedArtistIndex"] = sharedFilesDataGridView.Columns["Artist"].DisplayIndex.ToString(); m_Settings["sharedTitleIndex"] = sharedFilesDataGridView.Columns["Title"].DisplayIndex.ToString(); m_Settings["sharedlastRequestIndex"] = sharedFilesDataGridView.Columns["lastRequest"].DisplayIndex.ToString(); } }
/// <summary> /// Invalidates the drop-down button bounds when a column width changes /// in the DataGridView control. A width change in any column of the /// control has the potential to affect the drop-down button location, /// depending on the current horizontal scrolling position and whether /// the changed column is to the left or right of the current column. /// It is easier to invalidate the button in all cases. /// </summary> /// <param name="sender">The object that raised the event.</param> /// <param name="e">A DataGridViewColumnEventArgs that contains the event data.</param> private void DataGridView_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e) { ResetDropDown(); }
private void sharedFilesDataGridView_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e) { if (!m_start) { m_Settings["sharedIconWidth"] = sharedFilesDataGridView.Columns["Icon"].FillWeight.ToString(System.Globalization.CultureInfo.CreateSpecificCulture("de-de")); m_Settings["sharedRatingIconWidth"] = sharedFilesDataGridView.Columns["RatingIcon"].FillWeight.ToString(System.Globalization.CultureInfo.CreateSpecificCulture("de-de")); m_Settings["sharedFileNameWidth"] = sharedFilesDataGridView.Columns["FileName"].FillWeight.ToString(System.Globalization.CultureInfo.CreateSpecificCulture("de-de")); m_Settings["sharedFileSizeWidth"] = sharedFilesDataGridView.Columns["FileSize"].FillWeight.ToString(System.Globalization.CultureInfo.CreateSpecificCulture("de-de")); m_Settings["sharedDirectoryWidth"] = sharedFilesDataGridView.Columns["Directory"].FillWeight.ToString(System.Globalization.CultureInfo.CreateSpecificCulture("de-de")); m_Settings["sharedAlbumWidth"] = sharedFilesDataGridView.Columns["Album"].FillWeight.ToString(System.Globalization.CultureInfo.CreateSpecificCulture("de-de")); m_Settings["sharedArtistWidth"] = sharedFilesDataGridView.Columns["Artist"].FillWeight.ToString(System.Globalization.CultureInfo.CreateSpecificCulture("de-de")); m_Settings["sharedTitleWidth"] = sharedFilesDataGridView.Columns["Title"].FillWeight.ToString(System.Globalization.CultureInfo.CreateSpecificCulture("de-de")); m_Settings["sharedlastRequestWidth"] = sharedFilesDataGridView.Columns["lastRequest"].FillWeight.ToString(System.Globalization.CultureInfo.CreateSpecificCulture("de-de")); } }
protected override void OnColumnAdded(DataGridViewColumnEventArgs e) { if (typeof(TreeGridColumn).IsAssignableFrom(e.Column.GetType())) { if (_expandableColumn == null) { // identify the expanding column. _expandableColumn = (TreeGridColumn)e.Column; } else { // this.Columns.Remove(e.Column); //throw new InvalidOperationException("Only one TreeGridColumn per TreeGridView is supported."); } } // Expandable Grid doesn't support sorting. This is just a limitation of the sample. e.Column.SortMode = DataGridViewColumnSortMode.NotSortable; base.OnColumnAdded(e); }
internal void OnColumnAddedInternal (DataGridViewColumnEventArgs e) { e.Column.DataColumnIndex = FindDataColumnIndex (e.Column); if (e.Column.CellTemplate != null) { // The first column has just been added programatically instead of // autogenerated so we need to create the rows for the first time. // if (!is_autogenerating_columns && columns.Count == 1) ReBind (); // Add/Remove/Update the cells in the existing rows foreach (DataGridViewRow row in Rows) { if (row.Index == NewRowIndex) continue; DataGridViewCell newCell = (DataGridViewCell)e.Column.CellTemplate.Clone (); if (row.Cells.Count == columns.Count) { DataGridViewCell oldCell = row.Cells[e.Column.Index]; if (currentCell != null && oldCell == currentCell) currentCell = newCell; // copy the value only if the cell is not-databound if (!e.Column.IsDataBound && oldCell.OwningRow.DataBoundItem == null) newCell.Value = oldCell.Value; row.Cells.Replace (e.Column.Index, newCell); } else if (e.Column.Index >= row.Cells.Count) row.Cells.Add (newCell); else row.Cells.Insert (e.Column.Index, newCell); } } AutoResizeColumnsInternal (); OnColumnAdded (e); PrepareEditingRow (false, true); }
private void ShipView_ColumnDisplayIndexChanged( object sender, DataGridViewColumnEventArgs e ) { if ( IsRowsUpdating ) return; var group = CurrentGroup; if ( group != null ) { foreach ( DataGridViewColumn column in ShipView.Columns ) { group.ViewColumns[column.Name].DisplayIndex = column.DisplayIndex; } } }
private void MetroGrid_ColumnWidthChanged(object sender, System.Windows.Forms.DataGridViewColumnEventArgs e) { OnColumnWidthChanged(e); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Called when the column width changed. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewColumnEventArgs"/> /// instance containing the event data.</param> /// ------------------------------------------------------------------------------------ private void OnColumnWidthChanged(object sender, DataGridViewColumnEventArgs e) { TextBoxControl.Width = Width; }
void DTGV_ColumnAdded(object sender, DataGridViewColumnEventArgs e) { }