SpreadsheetGear
LocationToRange(Point) Method
See Also  Example Send Feedback
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

Visual Basic (Declaration) 
Public Overloads Function LocationToRange( _
   ByVal location As Point _
) As IRange
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: x86 and x64 versions of Windows 2000, Windows XP, Windows Vista, Windows 7, Windows Server 2003 (including R2) and Windows Server 2008 (including R2). SpreadsheetGear 2009 requires the Microsoft .NET Framework 2.0 and supports .NET 3.0 and .NET 3.5.

See Also

Copyright © 2003-2009 SpreadsheetGear LLC. All Rights Reserved.Help Powered by Innovasys   
SpreadsheetGear is a registered trademark of SpreadsheetGear LLC.
Microsoft, Microsoft Excel and Visual Studio are trademarks or registered trademarks of Microsoft Corporation.