使用 GridWeb 双击事件
Contents
[
Hide
]
Aspose.Cells.GridWeb包含三种类型的双击事件:
- CellDoubleClick,双击单元格时触发。
- ColumnDoubleClick,双击列标题时触发。
- RowDoubleClick,双击行标题时触发。
本主题讨论如何在 Aspose.Cells.GridWeb 中启用双击事件。它还讨论了为这些事件创建事件处理程序。
启用双击事件
通过将 GridWeb 控件的 EnableDoubleClickEvent 属性设置为 true,可以在客户端启用所有类型的双击事件。
默认情况下,EnableDoubleClickEvent 属性设置为 false。这意味着默认情况下不启用双击事件。要实施此类事件,请首先启用该功能。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// Enabling Double Click events | |
GridWeb1.EnableDoubleClickEvent = true; |
一旦启用了双击事件,就可以为任何双击事件创建事件处理程序。当给定的双击事件被触发时,这些事件处理程序执行特定的任务。
处理双击事件
要在 Visual Studio 中创建事件处理程序:
- 双击事件在“属性”窗格中列出。
对于此示例,我们为各种双击事件实现了事件处理程序。
双击 Cell
CellDoubleClick 事件的事件处理程序提供了一个 CellEventArgs 类型的参数,它提供了被双击的单元格的完整信息。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// Event Handler for CellDoubleClick event | |
protected void GridWeb1_CellDoubleClick(object sender, Aspose.Cells.GridWeb.CellEventArgs e) | |
{ | |
// Displaying the name of the cell (that is double clicked) in GridWeb's Message Box | |
string msg = "You just clicked <"; | |
msg += "Row: " + (e.Cell.Row + 1) + " Column: " + (e.Cell.Column + 1) + " Cell Name: " + e.Cell.Name + ">"; | |
GridWeb1.Message = msg; | |
} |
双击列标题
ColumnDoubleClick 事件的事件处理程序提供 RowColumnEventArgs 类型的参数,该参数提供被双击的标题的列索引号和其他信息。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// Event Handler for ColumnDoubleClick event | |
protected void GridWeb1_ColumnDoubleClick(object sender, Aspose.Cells.GridWeb.RowColumnEventArgs e) | |
{ | |
// Displaying the number of the column (whose header is double clicked) in GridWeb's Message Box | |
string msg = "You just clicked <"; | |
msg += "Column header: " + (e.Num + 1) + ">"; | |
GridWeb1.Message = msg; | |
} |
双击行标题
RowDoubleClick 事件的事件处理程序提供了一个 RowColumnEventArgs 类型的参数,该参数提供了被双击的标题行的索引号和其他相关信息。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// Event Handler for RowDoubleClick event | |
protected void GridWeb1_RowDoubleClick(object sender, Aspose.Cells.GridWeb.RowColumnEventArgs e) | |
{ | |
// Displaying the number of the row (whose header is double clicked) in GridWeb's Message Box | |
string msg = "You just clicked <"; | |
msg += "Row header: " + (e.Num + 1) + ">"; | |
GridWeb1.Message = msg; | |
} |