GetCellFromScreenCoord, ScriptGetCellFromScreenCoord Methods
Applies To
fpSpread control
Description
Returns the cell coordinates of the cell residing at the specified client coordinates.
Syntax
void CSpreadSheet::GetCellFromScreenCoord (long* Col, long* Row, long x, long y);
fpSpread.GetCellFromScreenCoord(Col As Long, Row As Long, ByVal x As Long, ByVal y As Long)
Note: The ScriptGetCellFromScreenCoord method uses the same syntax except method parameters that are not passed "ByVal" are declared as variants. For more information on Script methods, see Scripting Environment Usage. |
Parameters
The following parameters are available:
Parameter | Description |
---|---|
Col | Column number of cell Returns –1 for coordinates in gray area. |
Row | Row number of cell Returns –1 for coordinates in gray area. |
x | Client x-coordinate in twips |
y | Client y-coordinate in twips |
Remarks
This method is useful when the application is intercepting mouse messages.
The screen coordinates are specified in twips.
This method is called for the current sheet setting unless you first set the Sheet property to specify the sheet with which you want to work.
If you are using C++, you must convert from pixels to twips before calling the GetCellFromScreenCoord method. You can use the following code to perform the conversion.
void CMyDlg::OnMouseUpSpread1(short Button, short Shift, long x, long y)
{
long lCol, lRow;
long xTwips, yTwips;
.
.
.
CDC* pdc = this->GetDC( );
xTwips = x * 1440 / pdc->GetDeviceCaps(LOGPIXELSX);
yTwips = y * 1440 / pdc->GetDeviceCaps(LOGPIXELSY);
this->ReleaseDC(pdc);
m_Spread.GetCellFromScreenCoord(&lCol, &lRow, xTwips, yTwips);
.
.
.
}
Note: Call this method if you use the Spread control in a scripting environment (for example, Microsoft's Visual InterDev or Internet Explorer) or a non-scripting environment. However, if you want to use the Spread control in a scripting environment and you want to change any parameter that is not passed "ByVal", you must set the ScriptEnhanced property to True and call the ScriptGetCellFromScreenCoord method. ScriptGetCellFromScreenCoord method parameters that are not passed "ByVal" are declared as variants. |
Return Type
Returns the cell coordinates in the Col and Row parameters.
See Also
GetCellPos method
ScriptEnhanced, Sheet properties
DLL Correspondence
SSGetCellFromPixel function