Back to Devexpress

CellRange.IsIntersecting(CellRange) Method

officefileapi-devexpress-dot-spreadsheet-dot-cellrange-dot-isintersecting-x28-devexpress-dot-spreadsheet-dot-cellrange-x29.md

latest6.3 KB
Original Source

CellRange.IsIntersecting(CellRange) Method

Determines whether the current range intersects with the specified range.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
bool IsIntersecting(
    CellRange other
)
vb
Function IsIntersecting(
    other As CellRange
) As Boolean

Parameters

NameTypeDescription
otherCellRange

A cell range to be checked.

|

Returns

TypeDescription
Boolean

true if ranges intersect; otherwise, false.

|

Remarks

Use the CellRange.Intersect method to get the intersection of cell ranges.

To check whether a cell range contains another range, use the CellRange.Contains method.

The following code snippets (auto-collected from DevExpress Examples) contain references to the IsIntersecting(CellRange) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-spreadsheet-bind-spreadsheet-to-ms-sql-server-database/CS/WpfSpreadsheet_BindToDataSource/MainWindow.xaml.cs#L113

csharp
// display a dialog requesting the user to confirm the deletion of records.
if (boundRange.IsIntersecting(rowRange))
{

winforms-spreadsheet-bind-to-ms-sql-server-database/CS/SuppliersExample/Form1.cs#L94

csharp
// display a dialog requesting the user to confirm the deletion of records.
if (boundRange.IsIntersecting(rowRange)) {
    DialogResult result = MessageBox.Show("Want to delete the selected supplier(s)?", "Delete",

winforms-spreadsheet-use-custom-cell-editors/CS/DevAVInvoicing/Form1.cs#L118

csharp
DefinedName invoiceItems = sheet.DefinedNames.GetDefinedName("InvoiceItems");
    btnRemoveRecord.Enabled = invoiceItems != null && invoiceItems.Range.RowCount > 1 && invoiceItems.Range.IsIntersecting(sheet.SelectedCell);
}

winforms-spreadsheet-custom-draw-example/CS/WindowsFormsApp1/Form1.cs#L121

csharp
var dataRange = e.Cell.Worksheet.GetDataRange();
if (e.Cell.IsIntersecting(dataRange) && e.Cell.RowIndex % 2 != 0)
{

wpf-spreadsheet-bind-spreadsheet-to-ms-sql-server-database/VB/WpfSpreadsheet_BindToDataSource/MainWindow.xaml.vb#L96

vb
' display a dialog requesting the user to confirm the deletion of records.
If boundRange.IsIntersecting(rowRange) Then
    Dim result As MessageBoxResult = MessageBox.Show("Want to delete the selected supplier(s)?", "Delete", MessageBoxButton.YesNo, MessageBoxImage.Question)

winforms-spreadsheet-bind-to-ms-sql-server-database/VB/SuppliersExample/Form1.vb#L90

vb
' display a dialog requesting the user to confirm the deletion of records.
If boundRange.IsIntersecting(rowRange) Then
    Dim result As DialogResult = MessageBox.Show("Want to delete the selected supplier(s)?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question)

winforms-spreadsheet-use-custom-cell-editors/VB/DevAVInvoicing/Form1.vb#L109

vb
Dim invoiceItems As DefinedName = sheet.DefinedNames.GetDefinedName("InvoiceItems")
    btnRemoveRecord.Enabled = invoiceItems IsNot Nothing AndAlso invoiceItems.Range.RowCount > 1 AndAlso invoiceItems.Range.IsIntersecting(sheet.SelectedCell)
Else

winforms-spreadsheet-custom-draw-example/VB/CustomDrawExample/Form1.vb#L214

vb
Dim dataRange = e.Cell.Worksheet.GetDataRange()
If e.Cell.IsIntersecting(dataRange) AndAlso e.Cell.RowIndex Mod 2 <> 0 Then
    e.BackColor = Color.FromArgb(50, 91, 155, 213)

See Also

Intersect(CellRange)

Contains

CellRange Interface

CellRange Members

DevExpress.Spreadsheet Namespace