SpreadsheetGear.Windows.Forms Namespace > WorkbookView Class > LocationToRange Method : LocationToRange(Point) Method |
'Declaration
Public Overloads Function LocationToRange( _ ByVal location As System.Drawing.Point _ ) As IRange
'Usage
Dim instance As WorkbookView Dim location As System.Drawing.Point Dim value As IRange value = instance.LocationToRange(location)
/* * 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(); } }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2