// The pointer to my edit control.
extern CEdit* pmyEdit;
// The index of the char to get information on.
extern int nIndex;CString strText;pmyEdit->GetWindowText(strText);
strText = strText.Mid(nIndex, 1);// Get the text extent of the character.
CDC* pDC = pmyEdit->GetDC();
CSize sz = pDC->GetTextExtent(strText);
pmyEdit->ReleaseDC(pDC);CPoint pt = pmyEdit->PosFromChar(nIndex);// Dump the index, character, line number, and character bounds.
TRACE("nIndex = %d, character = %c, line = %d, bounds = {%d, %d, %d, %d}\r\n",
nIndex, strText[0], pmyEdit->LineFromChar(nIndex),
pt.x /* left */, pt.y /* top */,
pt.x+sz.cx /* right */, pt.y+sz.cy /* bottom */);
extern CEdit* pmyEdit;
// The index of the char to get information on.
extern int nIndex;CString strText;pmyEdit->GetWindowText(strText);
strText = strText.Mid(nIndex, 1);// Get the text extent of the character.
CDC* pDC = pmyEdit->GetDC();
CSize sz = pDC->GetTextExtent(strText);
pmyEdit->ReleaseDC(pDC);CPoint pt = pmyEdit->PosFromChar(nIndex);// Dump the index, character, line number, and character bounds.
TRACE("nIndex = %d, character = %c, line = %d, bounds = {%d, %d, %d, %d}\r\n",
nIndex, strText[0], pmyEdit->LineFromChar(nIndex),
pt.x /* left */, pt.y /* top */,
pt.x+sz.cx /* right */, pt.y+sz.cy /* bottom */);
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货