/// <summary> /// The column header has been clicked /// </summary> /// <param name="sender">Sender of event</param> /// <param name="e">Event arguments</param> private void OnColumnHeaderClicked(object sender, GridHeaderClickedArgs e) { if (e.RightClick) { this.view.ProfileGrid.ClearContextActions(); this.indexOfClickedVariable = e.Column.ColumnIndex; VariableProperty property = this.propertiesInGrid[this.indexOfClickedVariable]; foreach (string unit in property.AllowableUnits) { this.view.ProfileGrid.AddContextAction(unit, this.OnUnitClick); } } }
/// <summary> /// The column header has been clicked /// </summary> /// <param name="sender">Sender of event</param> /// <param name="e">Event arguments</param> private void OnColumnHeaderClicked(object sender, GridHeaderClickedArgs e) { if (e.RightClick) { this.view.ProfileGrid.ClearContextActions(); this.indexOfClickedVariable = e.Column.ColumnIndex; VariableProperty property = this.propertiesInGrid[this.indexOfClickedVariable]; if (property.AllowableUnits.Length > 0) { this.view.ProfileGrid.AddContextSeparator(); foreach (VariableProperty.NameLabelPair unit in property.AllowableUnits) { this.view.ProfileGrid.AddContextOption(unit.Name, unit.Label, this.OnUnitClick, unit.Name == property.Units); } } } }
/// <summary> /// User has clicked a cell. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void OnCellMouseDown(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex == -1) { if (this.ColumnHeaderClicked != null) { GridHeaderClickedArgs args = new GridHeaderClickedArgs(); args.Column = this.GetColumn(e.ColumnIndex); args.RightClick = e.Button == System.Windows.Forms.MouseButtons.Right; this.ColumnHeaderClicked.Invoke(this, args); } } else if (this.Grid[e.ColumnIndex, e.RowIndex] is Utility.ColorPickerCell) { ColorDialog dlg = new ColorDialog(); if (dlg.ShowDialog() == DialogResult.OK) { this.userEditingCell = true; this.valueBeforeEdit = this.Grid[e.ColumnIndex, e.RowIndex].Value; this.Grid[e.ColumnIndex, e.RowIndex].Value = dlg.Color.ToArgb(); } } }
/// <summary> /// The column header has been clicked /// </summary> /// <param name="sender">Sender of event</param> /// <param name="e">Event arguments</param> private void OnColumnHeaderClicked(object sender, GridHeaderClickedArgs e) { if (e.RightClick) { this.view.ProfileGrid.ClearContextActions(); this.indexOfClickedVariable = e.Column.ColumnIndex; VariableProperty property = this.propertiesInGrid[this.indexOfClickedVariable]; foreach (string unit in property.AllowableUnits) this.view.ProfileGrid.AddContextAction(unit, this.OnUnitClick); } }
private void OnButtonDown(object sender, ButtonPressEventArgs e) { if (e.Event.Button == 3) { if (this.ColumnHeaderClicked != null) { GridHeaderClickedArgs args = new GridHeaderClickedArgs(); if (sender is TreeView) { int i = 0; int xpos = (int)e.Event.X; foreach (Widget child in (sender as TreeView).AllChildren) { if (xpos >= child.Allocation.Left && xpos <= child.Allocation.Right) break; i++; } args.Column = this.GetColumn(i); } args.RightClick = true; this.ColumnHeaderClicked.Invoke(this, args); } Popup.Popup(); e.RetVal = true; } }
/// <summary> /// User has clicked a cell. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void OnCellMouseDown(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex == -1) { if (this.ColumnHeaderClicked != null) { GridHeaderClickedArgs args = new GridHeaderClickedArgs(); args.Column = this.GetColumn(e.ColumnIndex); args.RightClick = e.Button == System.Windows.Forms.MouseButtons.Right; this.ColumnHeaderClicked.Invoke(this, args); } } else if (this.Grid[e.ColumnIndex, e.RowIndex] is Utility.ColorPickerCell) { ColorDialog dlg = new ColorDialog(); if (dlg.ShowDialog() == DialogResult.OK) { this.userEditingCell = true; this.valueBeforeEdit = this.Grid[e.ColumnIndex, e.RowIndex].Value; this.Grid[e.ColumnIndex, e.RowIndex].Value = dlg.Color.ToArgb(); } } }