public override bool OnMouseMove(CellMouseEventArgs e) { if (IsPressed) { // requires the left button if (e.Buttons == unvell.ReoGrid.Interaction.MouseButtons.Left) { UpdateValueByCursorX(e.CellPosition, e.RelativePosition.X); } } return(false); }
private void Grid_CellMouseUp(object sender, CellMouseEventArgs e) { Position = e.CellPosition.ToString(); var column = e.CellPosition.ToString().Substring(0, 1); var row = e.CellPosition.ToString().Substring(1, 1); byte[] array = new byte[2]; //定义一组bai数组array array = System.Text.Encoding.ASCII.GetBytes(column); //将ABCD 转成对应1、2、3、4 int asciicode = (short)(array[0]) - 64; Row = int.Parse(row).ToString("000"); Column = asciicode.ToString("00"); //将转zhi换一的ASCII码转换成string型 }
/// <summary> /// Raises the MouseMove event /// </summary> /// <param name="e">A CellMouseEventArgs that contains the event data</param> public virtual void OnMouseMove(CellMouseEventArgs e) { this.Bounds = e.CellRect; if (e.Cell == null) { this.Padding = CellPadding.Empty; } else { this.Padding = e.Cell.Padding; } }
/* * private void AfterCellEdit(object sender, CellAfterEditEventArgs e) * { * WMSEntities wmsEntities = new WMSEntities(); * int row = e.Cell.Position.Row; * int id = int.Parse(this.reoGridControlUser.Worksheets[0][row, 0].ToString()); * ReceiptTicketItem receiptTicketItem = (from rti in wmsEntities.ReceiptTicketItem where rti.ID == id select rti).FirstOrDefault(); * if (receiptTicketItem != null) * { * int count; * if (int.TryParse(this.reoGridControlUser.Worksheets[0][row, this.checkBoxColumn].ToString(), out count) == false) * { * MessageBox.Show("请输入数字!"); * return; * } * if (receiptTicketItem.ReceiviptAmount != null) * { * if (count > receiptTicketItem.ReceiviptAmount) * { * MessageBox.Show("送检数量不应大于收货数量"); * this.reoGridControlUser.Worksheets[0][e.Cell.Position] = ""; * } * } * } * }*/ private void ClickOnCell(object sender, CellMouseEventArgs e) { var worksheet = this.reoGridControlUser.Worksheets[0]; var position = e.CellPosition; if ((position.Col != this.checkBoxColumn && position.Row < countRow) || position.Row >= countRow) { worksheet.CreateAndGetCell(position).IsReadOnly = true; } else { } }
/// <summary> /// Raises the MouseUp event /// </summary> /// <param name="e">A CellMouseEventArgs that contains the event data</param> public override void OnMouseUp(CellMouseEventArgs e) { base.OnMouseUp(e); // if (this.ShowUpDownButtons || this.TableUsingNumericCellEditor(e.Table, e.CellPos)) { if (e.Table.IsCellEditable(e.CellPos)) { // get the renderer data NumberRendererData rendererData = this.GetNumberRendererData(e.Cell); rendererData.ClickPoint = new Point(-1, -1); if (this.GetUpButtonBounds().Contains(e.X, e.Y)) { rendererData.UpButtonState = UpDownState.Hot; if (!e.Table.IsEditing) { e.Table.EditCell(e.CellPos); // Editing may be cancelled by an event handler } if (e.Table.IsEditing) { ((IEditorUsesRendererButtons)e.Table.EditingCellEditor).OnEditorButtonMouseUp(this, e); e.Table.Invalidate(e.CellRect); } } else if (this.GetDownButtonBounds().Contains(e.X, e.Y)) { rendererData.DownButtonState = UpDownState.Hot; if (!e.Table.IsEditing) { e.Table.EditCell(e.CellPos); } if (e.Table.IsEditing) { ((IEditorUsesRendererButtons)e.Table.EditingCellEditor).OnEditorButtonMouseUp(this, e); e.Table.Invalidate(e.CellRect); } } } } }
/// <summary> /// Raises the MouseDown event /// </summary> /// <param name="e">A CellMouseEventArgs that contains the event data</param> public override void OnMouseDown(CellMouseEventArgs e) { base.OnMouseDown(e); // if (this.ShowUpDownButtons || this.TableUsingNumericCellEditor(e.Table, e.CellPos)) { if (e.Table.IsCellEditable(e.CellPos)) { // get the button renderer data NumberRendererData rendererData = this.GetNumberRendererData(e.Cell); rendererData.ClickPoint = new Point(e.X, e.Y); if (this.CalcButtonBounds().Contains(e.X, e.Y)) { if (!(e.Table.ColumnModel.GetCellEditor(e.CellPos.Column) is DoubleCellEditor)) { throw new InvalidOperationException("Cannot edit Cell as NumberCellRenderer requires a NumberColumn that uses a NumberCellEditor"); } if (!e.Table.IsEditing) { e.Table.EditCell(e.CellPos); // Editing may be cancelled by an event handler } if (e.Table.IsEditing) { if (this.GetUpButtonBounds().Contains(e.X, e.Y)) { rendererData.UpButtonState = UpDownState.Pressed; ((IEditorUsesRendererButtons)e.Table.EditingCellEditor).OnEditorButtonMouseDown(this, e); e.Table.Invalidate(e.CellRect); } else if (this.GetDownButtonBounds().Contains(e.X, e.Y)) { rendererData.DownButtonState = UpDownState.Pressed; ((IEditorUsesRendererButtons)e.Table.EditingCellEditor).OnEditorButtonMouseDown(this, e); e.Table.Invalidate(e.CellRect); } } } } } }
/// <summary> /// Raises the MouseLeave event /// </summary> /// <param name="e">A CellMouseEventArgs that contains the event data</param> public override void OnMouseLeave(CellMouseEventArgs e) { base.OnMouseLeave(e); // get the button renderer data ButtonRendererData rendererData = this.GetButtonRendererData(e.Cell); // make sure the button is in its normal state if (rendererData.ButtonState != PushButtonStates.Normal) { rendererData.ButtonState = PushButtonStates.Normal; e.Table.Invalidate(e.CellRect); } }
/// <summary> /// worksheet_CellMouseDown事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void worksheet_CellMouseDown(object sender, CellMouseEventArgs e) { if (row == 0) { worksheet.SetSettings(WorksheetSettings.Edit_Readonly, true); } else { if (e.CellPosition.Row < row) { worksheet.SetSettings(WorksheetSettings.Edit_Readonly, false); //contentsList(); string bookname = txbCe.Text.Substring(0, txbCe.Text.LastIndexOf("_")); if (cell != string.Empty) { if (cellnum >= 1) { worksheet[cell] = new CellBody(); } //worksheet.SelectionMode = WorksheetSelectionMode.Cell; } cellnum = e.CellPosition.Col; cell = e.CellPosition.ToString(); #region if (e.CellPosition.Col == 4) //D { worksheet[e.CellPosition] = new DropdownListCell(resultRSORTList.ToArray()); } if (e.CellPosition.Col == 6) //F { worksheet[e.CellPosition] = new DropdownListCell(catologList.ToArray()); } if (e.CellPosition.Col == 11)//K { worksheet[e.CellPosition] = new DropdownListCell(banquanMirror.Values.ToArray()); } if (e.CellPosition.Col == 12)//L { worksheet[e.CellPosition] = new DropdownListCell(resultZYDLList.ToArray()); } #endregion } else { worksheet.SetSettings(WorksheetSettings.Edit_Readonly, true); } } }
/// <summary> /// Restore color of hyperlink to normal-status or hover-status when mouse button was released from cell. /// </summary> /// <param name="e">Event argument of cell body mouse-up.</param> /// <returns>True if event has been handled.</returns> public override bool OnMouseUp(CellMouseEventArgs e) { if (this.IsPressed) { if (this.Bounds.Contains(e.RelativePosition)) { this.PerformClick(); } } this.IsPressed = false; e.Cell.Style.TextColor = VisitedColor; return(true); }
/// <summary> /// Raises the MouseDown event /// </summary> /// <param name="e">A CellMouseEventArgs that contains the event data</param> public override void OnMouseDown(CellMouseEventArgs e) { base.OnMouseDown(e); if (!this.ShowDropDownButton && (!e.Table.IsEditing || e.CellPos != e.Table.EditingCell)) { return; } if (!e.Table.IsCellEditable(e.CellPos)) { return; } // get the button renderer data DropDownRendererData rendererData = this.GetDropDownRendererData(e.Cell); if (!this.CalcDropDownButtonBounds().Contains(e.X, e.Y)) { return; } var isDropDownCellEditor = e.Table.ColumnModel.GetCellEditor(e.CellPos.Column) is DropDownCellEditor; if (!isDropDownCellEditor) { // var msg = "Cannot edit Cell as DropDownCellRenderer requires a DropDownColumn " + // "that uses a DropDownCellEditor"; // throw new InvalidOperationException(msg); return; } rendererData.ButtonState = ComboBoxState.Pressed; if (!e.Table.IsEditing) { e.Table.EditCell(e.CellPos); } //netus - fix from John Boyce on 2006-02-08 if (e.Table.IsEditing) { ((IEditorUsesRendererButtons)e.Table.EditingCellEditor).OnEditorButtonMouseDown(this, e); e.Table.Invalidate(e.CellRect); } }
/// <summary> /// Raises the MouseEnter event /// </summary> /// <param name="e">A CellMouseEventArgs that contains the event data</param> public virtual void OnMouseEnter(CellMouseEventArgs e) { this.Bounds = e.CellRect; this.Padding = e.Cell == null ? CellPadding.Empty : e.Cell.Padding; bool tooltipActive = e.Table.ToolTip.Active; if (tooltipActive) { e.Table.ToolTip.Active = false; } e.Table.ResetMouseEventArgs(); if (tooltipActive) { if (e.Cell != null) { CellToolTipEventArgs args = new CellToolTipEventArgs(e.Cell, new Point(e.X, e.Y)); // The default tooltip is to show the full text for any cell that has been truncated if (e.Cell.IsTextTrimmed) { args.ToolTipText = e.Cell.Text; } // Allow the outside world to modify the text or cancel this tooltip e.Table.OnCellToolTipPopup(args); // Even if this tooltip has been cancelled we need to get rid of the old tooltip if (args.Cancel) { e.Table.ToolTip.SetToolTip(e.Table, string.Empty); } else { e.Table.ToolTip.SetToolTip(e.Table, args.ToolTipText); } } else { e.Table.ToolTip.SetToolTip(e.Table, string.Empty); } e.Table.ToolTip.Active = true; } }
private void Grid_CellMouseLeave(object sender, CellMouseEventArgs e) { if (chkLeave.Checked) { Log("CellMouseLeave: " + e.CellPosition); } if (chkHoverHighlight.Checked) { worksheet.RemoveRangeBorders(new RangePosition(e.CellPosition, e.CellPosition), BorderPositions.Outside); } if (chkBackground.Checked) { worksheet.RemoveRangeStyles(new RangePosition(e.CellPosition, e.CellPosition), PlainStyleFlag.BackColor); } }
/// <summary> /// Determine whether the button is pressed or released /// </summary> /// <param name="e">mouse event argument</param> /// <returns>true to notify spreadsheet that event has been handled</returns> public override bool OnMouseUp(CellMouseEventArgs e) { if (IsPressed) { if (Bounds.Contains(e.RelativePosition)) { this.PerformClick(); } IsPressed = false; return(true); } else { return(false); } }
/// <summary> /// Raises the DoubleClick event /// </summary> /// <param name="e">A CellMouseEventArgs that contains the event data</param> public virtual void OnDoubleClick(CellMouseEventArgs e) { this.Bounds = e.CellRect; if (e.Cell == null) { this.Padding = CellPadding.Empty; } else { this.Padding = e.Cell.Padding; } if (e.Table.EditStartAction == EditStartAction.DoubleClick && e.Table.IsCellEditable(e.CellPos)) { e.Table.EditCell(e.CellPos); } }
/// <summary> /// Raises the MouseUp event /// </summary> /// <param name="e">A CellMouseEventArgs that contains the event data</param> public override void OnMouseUp(CellMouseEventArgs e) { base.OnMouseUp(e); if (e.Table.IsCellEditable(e.CellPos)) { // get the renderer data CheckBoxRendererData rendererData = this.GetCheckBoxRendererData(e.Cell); if (this.CalcCheckRect(e.Table.TableModel.Rows[e.Row].Alignment, e.Table.ColumnModel.Columns[e.Column].Alignment).Contains(e.X, e.Y)) { if (e.Button == MouseButtons.Left && e.Table.LastMouseDownCell.Row == e.Row && e.Table.LastMouseDownCell.Column == e.Column) { // if (e.Cell.CheckState == CheckState.Checked) { if (!e.Cell.ThreeState || !(e.Table.ColumnModel.Columns[e.Column] is CheckBoxColumn) || ((CheckBoxColumn)e.Table.ColumnModel.Columns[e.Column]).CheckStyle == CheckBoxColumnStyle.RadioButton) { rendererData.CheckState = CheckBoxStates.UncheckedHot; e.Cell.CheckState = CheckState.Unchecked; } else { rendererData.CheckState = CheckBoxStates.MixedHot; e.Cell.CheckState = CheckState.Indeterminate; } } else if (e.Cell.CheckState == CheckState.Indeterminate) { rendererData.CheckState = CheckBoxStates.UncheckedHot; e.Cell.CheckState = CheckState.Unchecked; } else //if (e.Cell.CheckState == CheckState.Unchecked) { rendererData.CheckState = CheckBoxStates.CheckedHot; e.Cell.CheckState = CheckState.Checked; } e.Table.Invalidate(e.CellRect); } } } }
/// <summary> /// Handler for the editors buttons MouseDown event /// </summary> /// <param name="sender">The object that raised the event</param> /// <param name="e">A CellMouseEventArgs that contains the event data</param> public void OnEditorButtonMouseDown(object sender, CellMouseEventArgs e) { this.ParseEditText(); if (e.Y < this.buttonBounds.Top + (this.buttonBounds.Height / 2)) { this.buttonID = UpButtonID; this.UpButton(); } else { this.buttonID = DownButtonID; this.DownButton(); } this.StartTimer(); }
/// <summary> /// Raises the MouseUp event /// </summary> /// <param name="e">A CellMouseEventArgs that contains the event data</param> public override void OnMouseUp(CellMouseEventArgs e) { base.OnMouseUp(e); // get the button renderer data ButtonRendererData rendererData = this.GetButtonRendererData(e.Cell); // check for the left mouse button if (e.Button == MouseButtons.Left) { Rectangle buttonRect = this.CalcButtonBounds(); // if the mouse pointer is over the button, make sure // the button is "hot" if (buttonRect.Contains(e.X, e.Y)) { rendererData.ButtonState = PushButtonStates.Hot; e.Table.Invalidate(e.CellRect); // check if the click started inside the button. if // it did, Raise the tables CellButtonClicked event if (buttonRect.Contains(rendererData.ClickPoint)) { e.Table.OnCellButtonClicked(new CellButtonEventArgs(e.Cell, e.Column, e.Row)); } } else { // the mouse was released somewhere outside of the button, // so make set the button back to its normal state if (rendererData.ButtonState != PushButtonStates.Normal) { rendererData.ButtonState = PushButtonStates.Normal; e.Table.Invalidate(e.CellRect); } } } // reset the click point rendererData.ClickPoint = Point.Empty; }
/// <summary> /// Process when mouse button pressed inside cell. /// </summary> /// <param name="e"></param> /// <returns></returns> public override bool OnMouseDown(CellMouseEventArgs e) { if (PullDownOnClick || dropdownButtonRect.Contains(e.RelativePosition)) { if (this.isDropdown) { PullUp(); } else { PushDown(); } return(true); } else { return(false); } }
/// <summary> /// Raises the MouseUp event /// </summary> /// <param name="e">A CellMouseEventArgs that contains the event data</param> public override void OnMouseUp(CellMouseEventArgs e) { base.OnMouseUp(e); if (this.ShowDropDownButton || (e.Table.IsEditing && e.CellPos == e.Table.EditingCell)) { if (e.Table.IsCellEditable(e.CellPos)) { // get the renderer data DropDownRendererData rendererData = this.GetDropDownRendererData(e.Cell); if (this.CalcDropDownButtonBounds().Contains(e.X, e.Y)) { rendererData.ButtonState = ComboBoxStates.Hot; e.Table.Invalidate(e.CellRect); } } } }
/// <summary> /// Handle the mouse up event. /// </summary> /// <param name="e">Arguments of mouse up event.</param> /// <returns>True if event has been handled; Otherwise return false.</returns> public override bool OnMouseUp(CellMouseEventArgs e) { if (this.IsPressed) { this.IsPressed = false; if (ContentBounds.Contains(e.RelativePosition)) { this.ToggleCheckStatus(); this.RaiseClickEvent(); } return(true); } else { return(false); } }
/// <summary> /// Raises the MouseLeave event /// </summary> /// <param name="e">A CellMouseEventArgs that contains the event data</param> public override void OnMouseLeave(CellMouseEventArgs e) { base.OnMouseLeave(e); if (this.ShowDropDownButton || (e.Table.IsEditing && e.CellPos == e.Table.EditingCell)) { if (e.Table.IsCellEditable(e.CellPos)) { // get the button renderer data DropDownRendererData rendererData = this.GetDropDownRendererData(e.Cell); if (rendererData.ButtonState != ComboBoxStates.Normal) { rendererData.ButtonState = ComboBoxStates.Normal; e.Table.Invalidate(e.CellRect); } } } }
/// <summary> /// Raises the MouseDown event /// </summary> /// <param name="e">A CellMouseEventArgs that contains the event data</param> public virtual void OnMouseDown(CellMouseEventArgs e) { if (!e.Table.Focused) { if (!(e.Table.IsEditing && e.Table.EditingCell == e.CellPos && e.Table.EditingCellEditor is IEditorUsesRendererButtons)) { e.Table.Focus(); } } this.Bounds = e.CellRect; if (e.Cell == null) { this.Padding = CellPadding.Empty; } else { this.Padding = e.Cell.Padding; } }
private void Grid_CellMouseEnter(object sender, CellMouseEventArgs e) { if (chkEnter.Checked) { Log("CellMouseEnter: " + e.CellPosition); } if (chkHoverHighlight.Checked) { worksheet.SetRangeBorders(new RangePosition(e.CellPosition, e.CellPosition), BorderPositions.Outside, RangeBorderStyle.GraySolid); } if (chkBackground.Checked) { worksheet.SetRangeStyles(new RangePosition(e.CellPosition, e.CellPosition), new WorksheetRangeStyle { Flag = PlainStyleFlag.BackColor, BackColor = Color.Silver, }); } }
/// <summary> /// Raises the MouseMove event /// </summary> /// <param name="e">A CellMouseEventArgs that contains the event data</param> public override void OnMouseMove(CellMouseEventArgs e) { base.OnMouseMove(e); if (this.ShowDropDownButton || (e.Table.IsEditing && e.CellPos == e.Table.EditingCell)) { if (e.Table.IsCellEditable(e.CellPos)) { // get the button renderer data DropDownRendererData rendererData = this.GetDropDownRendererData(e.Cell); if (this.CalcDropDownButtonBounds().Contains(e.X, e.Y)) { if (rendererData.ButtonState == ComboBoxStates.Normal) { if (e.Button == MouseButtons.Left && e.Row == e.Table.LastMouseDownCell.Row && e.Column == e.Table.LastMouseDownCell.Column) { rendererData.ButtonState = ComboBoxStates.Pressed; } else { rendererData.ButtonState = ComboBoxStates.Hot; } e.Table.Invalidate(e.CellRect); } } else { if (rendererData.ButtonState != ComboBoxStates.Normal) { rendererData.ButtonState = ComboBoxStates.Normal; e.Table.Invalidate(e.CellRect); } } } } }
/// <summary> /// Raises the MouseDown event /// </summary> /// <param name="e">A CellMouseEventArgs that contains the event data</param> public override void OnMouseDown(CellMouseEventArgs e) { base.OnMouseDown(e); // get the button renderer data ButtonRendererData rendererData = this.GetButtonRendererData(e.Cell); // check if the left mouse button is pressed if (e.Button == MouseButtons.Left) { // record where the click started rendererData.ClickPoint = new Point(e.X, e.Y); // if the click was inside the button, set the button state to pressed if (this.CalcButtonBounds().Contains(rendererData.ClickPoint)) { rendererData.ButtonState = PushButtonStates.Pressed; e.Table.Invalidate(e.CellRect); } } }
/// <summary> /// Raises the MouseLeave event /// </summary> /// <param name="e">A CellMouseEventArgs that contains the event data</param> public override void OnMouseLeave(CellMouseEventArgs e) { base.OnMouseLeave(e); if (e.Table.IsCellEditable(e.CellPos)) { // get the renderer data CheckBoxRendererData rendererData = this.GetCheckBoxRendererData(e.Cell); if (e.Cell.CheckState == CheckState.Checked) { if (rendererData.CheckState != CheckBoxStates.CheckedNormal) { rendererData.CheckState = CheckBoxStates.CheckedNormal; e.Table.Invalidate(e.CellRect); } } else if (e.Cell.CheckState == CheckState.Indeterminate) { if (rendererData.CheckState != CheckBoxStates.MixedNormal) { rendererData.CheckState = CheckBoxStates.MixedNormal; e.Table.Invalidate(e.CellRect); } } else //if (e.Cell.CheckState == CheckState.Unchecked) { if (rendererData.CheckState != CheckBoxStates.UncheckedNormal) { rendererData.CheckState = CheckBoxStates.UncheckedNormal; e.Table.Invalidate(e.CellRect); } } } }
private void Sheet2_CellMouseDown(object sender, CellMouseEventArgs e) { Data.indexRow = e.CellPosition.Row; }
void columnKeyDown(object sender, CellMouseEventArgs e) { }
public override bool OnMouseEnter(CellMouseEventArgs e) { IsHover = true; return true; }
public override bool OnMouseUp(CellMouseEventArgs e) { IsPressed = false; return base.OnMouseUp(e); }
public override bool OnMouseLeave(CellMouseEventArgs e) { IsHover = false; return true; }
/// <summary> /// Raises the MouseMove event /// </summary> /// <param name="e">A CellMouseEventArgs that contains the event data</param> public override void OnMouseMove(CellMouseEventArgs e) { base.OnMouseMove(e); // get the button renderer data ButtonRendererData rendererData = this.GetButtonRendererData(e.Cell); Rectangle buttonRect = this.CalcButtonBounds(); // check if the left mouse button is pressed if (e.Button == MouseButtons.Left) { // check if the mouse press originated in the button area if (buttonRect.Contains(rendererData.ClickPoint)) { // check if the mouse is currently in the button if (buttonRect.Contains(e.X, e.Y)) { // make sure the button is pressed if (rendererData.ButtonState != PushButtonStates.Pressed) { rendererData.ButtonState = PushButtonStates.Pressed; e.Table.Invalidate(e.CellRect); } } else { // the mouse isn't inside the button so make sure it is "hot" if (rendererData.ButtonState != PushButtonStates.Hot) { rendererData.ButtonState = PushButtonStates.Hot; e.Table.Invalidate(e.CellRect); } } } } else { // check if the mouse is currently in the button if (buttonRect.Contains(e.X, e.Y)) { // the mouse is inside the button so make sure it is "hot" if (rendererData.ButtonState != PushButtonStates.Hot) { rendererData.ButtonState = PushButtonStates.Hot; e.Table.Invalidate(e.CellRect); } } else { // not inside the button so make sure it is in its normal state if (rendererData.ButtonState != PushButtonStates.Normal) { rendererData.ButtonState = PushButtonStates.Normal; e.Table.Invalidate(e.CellRect); } } } }
void sheet_CellMouseDown(object sender, CellMouseEventArgs e) { var sheet = reoGridControl2.CurrentWorksheet; string temp = sheet.ColumnHeaders[e.CellPosition.Col].Text; if (temp == "VAR") temp = ""; label1.Text = e.CellPosition.Row+1 + " : " + temp ; if (e.Cell != null && e.Cell.Data!=null) textBox1.Text = e.Cell.Data.ToString(); else textBox1.Text = ""; if (e.CellPosition.Row == sheet.RowCount-1) sheet.InsertRows(sheet.RowCount-1, 100); }