怎么得到richedit控件中的最大列数?

马鸣风萧萧 2003-05-07 11:49:16
RT
...全文
50 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
azuretttc 2003-05-24
  • 打赏
  • 举报
回复
I think u shold scan every line,and use the func LineLength,to get the max one
宝_爸 2003-05-07
  • 打赏
  • 举报
回复
应该不麻烦吧,只是效率可能慢一点。

如果有效率的需求,可以采用类似于缓存的技术,先在自己的一个buffer里排序好了,在给richedit显示。
马鸣风萧萧 2003-05-07
  • 打赏
  • 举报
回复
谁有更好的办法?
马鸣风萧萧 2003-05-07
  • 打赏
  • 举报
回复
必须得到总行数,然后再依次得到列数,再进行排序吗?
马鸣风萧萧 2003-05-07
  • 打赏
  • 举报
回复
: findcaiyzh(秋心)
是啊,正是因为每行显示的字符数可能不同,才想得到其中字符数最多的行的列数,就是这个意思。有没有现成的函数啊?
宝_爸 2003-05-07
  • 打赏
  • 举报
回复
每行显示的字符数可能不同,所以只能取得某一行的长度。
宝_爸 2003-05-07
  • 打赏
  • 举报
回复
CRichEditCtrl::LineLength
int LineLength( int nLine = -1 ) const;

Return Value

When 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, the return value is the length (in bytes) of the text in the edit control.

Parameters

nLine

Specifies the character index of a character in the line whose length is to be retrieved. If this parameter is –1, the length of the current line (the line that contains the caret) is returned, not including the length of any selected text within the line. When LineLength is called for a single-line edit control, this parameter is ignored.

Remarks

Call this function to retrieve the length of a line in a rich edit control.

Use the LineIndex member function to retrieve a character index for a given line number within this CRichEditCtrl object.

For more information, seeEM_LINELENGTH in the Win32 documentation.

Example

See the example for LineIndex.

CRichEditCtrl Overview | Class Members | Hierarchy Chart

See Also CRichEditCtrl::LineIndex

马鸣风萧萧 2003-05-07
  • 打赏
  • 举报
回复
可以用getlinecount得到总行数,有得到当前显示文本的最大列数的吗?

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧