Поделиться через


CEdit::CharFromPos

Call this function to retrieve the zero-based line and character indices of the character nearest the specified point in this CEdit control

int CharFromPos(
   CPoint pt 
) const;

Параметры

  • pt
    The coordinates of a point in the client area of this CEdit object.

Возвращаемое значение

The character index in the low-order WORD, and the line index in the high-order WORD.

Заметки

ПримечаниеПримечание.

This member function is available beginning with Windows 95 and Windows NT 4.0.

For more information, see EM_CHARFROMPOS in the Windows SDK.

Пример

// CMyEdit inherits from CEdit
void CMyEdit::OnLButtonDown(UINT nFlags, CPoint point)
{
   int n = CharFromPos(point);
   int nLineIndex = HIWORD(n);
   int nCharIndex = LOWORD(n);
   TRACE(_T("nLineIndex = %d, nCharIndex = %d\r\n"), nLineIndex, nCharIndex);

   CEdit::OnLButtonDown(nFlags, point);
}

Требования

Header: afxwin.h

См. также

Основные понятия

CEdit Class

CEdit Members

Hierarchy Chart

CEdit::PosFromChar