SpreadsheetGear The Performance Spreadsheet Component Company 
LocationToRange Method
See Also  Example
SpreadsheetGear.Windows.Forms Namespace > WorkbookView Class : LocationToRange Method
location
Specifies the location.
Returns an instance of IRange representing the cell at the specified location or null if there is none.

Syntax

C# 
public IRange LocationToRange( 
   Point location
)

Parameters

location
Specifies the location.

Return Value

An instance of IRange representing the cell at the specified location or null if there is none

Example

C#Copy Code
/* 
         * Demonstrate using the WorkbookView.LocationToRange method to convert 
         * from mouse coordinates to an instance of SpreadsheetGear.IRange. 
         */ 
        private void workbookView_MouseDown(object sender, MouseEventArgs e) 
        { 
            // Acquire a lock on the workbook set. 
            workbookView.GetLock(); 
            try 
            { 
                // Get the range associated with the mouse location. 
                SpreadsheetGear.IRange range = 
                    workbookView.LocationToRange(e.Location); 
  
                // If this location contains a range, set the interior to blue. 
                if (range != null) 
                    range.EntireMergeArea.Interior.Color = Color.Blue; 
            } 
            finally 
            { 
                // Release the lock on the workbook set. 
                workbookView.ReleaseLock(); 
            } 
        } 
    

Requirements

Platforms: Windows 98, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family. SpreadsheetGear for .NET 1.x requires the Microsoft .NET Framework 1.1 or .NET 2.0. SpreadsheetGear for .NET 2006 requires the Microsoft .NET Framework 2.0.

See Also