SpreadsheetGear The Performance Spreadsheet Component Company 
LocationToRange(Point) Method
See Also  Example
SpreadsheetGear.Windows.Forms Namespace > WorkbookView Class > LocationToRange Method : LocationToRange(Point) 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 Vista, Windows XP, Windows Server 2008, Windows Server 2003, Windows 2000, Windows Me and Windows 98, including 32 bit and 64 bit editions where applicable. SpreadsheetGear for .NET 1.x requires the Microsoft .NET Framework 1.1 or .NET 2.0 (works with .NET 3.x). SpreadsheetGear for .NET 2007 requires the Microsoft .NET Framework 2.0 (works with .NET 3.x).

See Also