العمل مع أحداث النقر المزدوج في GridWeb

تمكين أحداث النقر المزدوج

يمكن تمكين جميع أنواع أحداث النقر المزدوج على الجانب العميلي عن طريق ضبط خاصية EnableDoubleClickEvent لعنصر تحكم GridWeb على true.

// 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:

  1. انقر نقرًا مزدوجًا على الحدث في قائمة الأحداث في نافذة الخصائص.

على سبيل المثال، قمنا بتنفيذ معالجين لأحداث النقر المزدوج المختلفة.

نقر مزدوج على الخلية

يوفر معالج الحدث لحدث CellDoubleClick وسيطًا من نوع CellEventArgs، الذي يوفر المعلومات الكاملة عن الخلية التي تم النقر عليها.

// 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 الذي يوفر رقم الفهرس للعمود الذي تم النقر عليه ومعلومات أخرى.

// 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 الذي يوفر رقم الفهرس للصف الذي تم النقر عليه ومعلومات أخرى ذات صلة.

// 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;
}