CEdit类里的LineLength函数是怎么用的啊?
我是这样调用的:
CEdit theEdit;//这个theEdit已经获得当前cedit控件的句柄的了。
CString set;//用来测试bufsize的值。
lineno=0;
while(theEdit->LineIndex(lineno)!=-1)//当没有到最后一行时
{
bufsize=theEdit->LineLength(lineno++);
set.Format("bufsize=%d,lineno=%d",bufsize,lineno);
MessageBox(set);
}
但bufsize的值没有象预期中地变,而是很奇怪的。。
假设我的控件里的第一行的文字是:abcdefg 七个字母
其他行的并不是七个字母的
但messagebox显示的是:
bufsize=7,lineno=1
bufsize=7,lineno=2
bufsize=7,lineno=3 bufsize=7,lineno=4
bufsize=7,lineno=5
bufsize=7,lineno=6
bufsize=7,lineno=7
bufsize=7,lineno=8
就是说bufsize会保持八次不变,怎么回事呢?
我是这样调用的:
CEdit theEdit;//这个theEdit已经获得当前cedit控件的句柄的了。
CString set;//用来测试bufsize的值。
lineno=0;
while(theEdit->LineIndex(lineno)!=-1)//当没有到最后一行时
{
bufsize=theEdit->LineLength(lineno++);
set.Format("bufsize=%d,lineno=%d",bufsize,lineno);
MessageBox(set);
}
但bufsize的值没有象预期中地变,而是很奇怪的。。
假设我的控件里的第一行的文字是:abcdefg 七个字母
其他行的并不是七个字母的
但messagebox显示的是:
bufsize=7,lineno=1
bufsize=7,lineno=2
bufsize=7,lineno=3 bufsize=7,lineno=4
bufsize=7,lineno=5
bufsize=7,lineno=6
bufsize=7,lineno=7
bufsize=7,lineno=8
就是说bufsize会保持八次不变,怎么回事呢?
解决方案 »
- 在listctrl控件的一列中插入combox控件,同时combox控件里面的内容不同
- 请问如何在命令提示符窗口输出超长的信息?
- 有没有什么办法能获得调用external函数的javascript代码是在哪个框架里?
- 用WININET 模拟POST动作,怎么样知道服务器的返回??
- vc 6.0里面dialog类从Cdialog派生,在其中增加一个菜单
- 请问怎样创建一个自定义位图并显示出来?
- 100分,求鼠标或键盘光标选择不同行时,DBGrid响应的代码
- 我编一个程序,想通过这个程序知道本机是否通过拨号上网了,该怎么办(API)的
- 有没有做过短信网关的?
- 请问如何得到其它正在运行程序的控件名和内容?
- 如何定义一个占2位的变量,并且可以使用数组?
- 小问题啊,帮帮我吧
int LineIndex( int nLine = -1 ) const;Return ValueThe character index of the line specified in nLine or –1 if the specified line number is greater then the number of lines in the edit control.
就是说当行数大于edit控件中的总行数时就会返回-1的吧?
但这个不是主要问题,我是想知道bufsize的值为什么不会随着行号变的呢?
好象是这样的
linelength(int nline)在msdn里明明是说返回第nline行的字符数的啊。。,
555,怎么没人回答一下啊
int LineLength( int nLine = -1 ) const;Return ValueWhen LineLength is called for a multiple-line edit control, the return value is the length (in bytes) of the line specified by
~~~~~~~~~~~~
nLine. When LineLength is called for a single-line edit control,
~~~~~~这里的意思是不是nline应该是整个edit控件里的索引值呢?恩,我想应该是了。试试先。。:)
the return value is the length (in bytes) of the text in the edit control.