CEdit::LineLength无法正确获得字符数( 看到别人的问题),于是自己测试了函数linelength,结果发现linegth却是无法正确获得字符数edit是个多行的属性,我已经勾选了风格和接受回车的属性
即:
  EDITTEXT        IDC_EDIT1,51,29,98,30,ES_MULTILINE | ES_AUTOHSCROLL | ES_WANTRETURN
测试的时候输入的内容为:
dd
dvoid Ctesst33Dlg::OnBnClickedButton1()
{
// TODO: 在此添加控件通知处理程序代码
// TODO: 在此添加控件通知处理程序代码
int n=m_edit.LineLength(10); //n为1

}
 而msdn:CEdit::LineLengthVisual Studio 2008 Other Versions 0 out of 2 rated this helpful - Rate this topic
Updated: September 2008
Retrieves the length of a line in an edit control.
int LineLength(
   int nLine = -1 
) const;
Parameters
nLine
The zero-based index of a character in the line whose length is to be retrieved. The default value is -1.
Return Value
For single-line edit controls, the return value is the length, in TCHARs, of the text in the edit control.
For multiline edit controls, the return value is the length, in TCHARs, of the line specified by the nLine parameter. For ANSI text, the length is the number of bytes in the line; for Unicode text, the length is the number of characters in the line. The length does not include the carriage-return character at the end of the line.
If the nLine parameter is more than the number of characters in the control, the return value is zero.
If the nLine parameter is –1, the return value is the number of unselected characters in the lines that contain selected characters. For example, if the selection extends from the fourth character of one line through the eighth character from the end of the next line, the return value is 10. That is, three characters on the first line and seven on the next.
For more information about the TCHAR type, see the TCHAR row in the table in Windows Data Types.