CPF/CPF.ReoGrid/Events/CellMouseEventArgs.cs

45 lines
2.0 KiB
C#
Raw Normal View History

2024-06-24 10:15:59 +08:00
using System;
using CPF.Drawing;
using CPF.ReoGrid.Interaction;
namespace CPF.ReoGrid.Events
{
public class CellMouseEventArgs : WorksheetMouseEventArgs
{
public Cell Cell { get; set; }
public CellPosition CellPosition { get; set; }
// 基本构造函数
public CellMouseEventArgs(Worksheet worksheet, Cell cell, CellPosition cellPosition, Point relativePosition, Point absolutePosition, MouseButtons buttons, int clicks)
: base(worksheet, relativePosition, absolutePosition, buttons, clicks) // 调用基类的构造函数
{
this.Cell = cell;
this.CellPosition = cellPosition;
}
// 重载构造函数,使用默认的相对位置和绝对位置
public CellMouseEventArgs(Worksheet worksheet, CellPosition cellPosition)
: this(worksheet, null, cellPosition, new Point(0, 0), new Point(0, 0), MouseButtons.None, 0)
{
}
// 重载构造函数,使用指定的相对位置和绝对位置
public CellMouseEventArgs(Worksheet worksheet, CellPosition cellPosition, Point relativePosition, Point absolutePosition, MouseButtons buttons, int clicks)
: this(worksheet, null, cellPosition, relativePosition, absolutePosition, buttons, clicks)
{
}
// 重载构造函数,使用单元格实例
public CellMouseEventArgs(Worksheet worksheet, Cell cell)
: this(worksheet, cell, (cell == null) ? CellPosition.Empty : cell.InternalPos, new Point(0, 0), new Point(0, 0), MouseButtons.None, 0)
{
}
// 重载构造函数,使用单元格实例和指定的相对位置及绝对位置
public CellMouseEventArgs(Worksheet worksheet, Cell cell, Point relativePosition, Point absolutePosition, MouseButtons buttons, int clicks)
: this(worksheet, cell, (cell == null) ? CellPosition.Empty : cell.InternalPos, relativePosition, absolutePosition, buttons, clicks)
{
}
}
}