当前位置:网站首页>C# richTextBox控制最大行数
C# richTextBox控制最大行数
2022-06-23 07:29:00 【pcjiushizhu】
private void m_txtComment_TextChanged(object sender, EventArgs e)
{
int lines = m_txtComment.GetLineFromCharIndex(m_txtComment.Text.Length - 1); //m_txtComment.Lines.Length; //行数
if(lines > maxLine - 1)
{
//第6行第一个字的位置
int my_index = m_txtComment.GetFirstCharIndexFromLine(maxLine);
//只保留前五行
m_txtComment.Text = m_txtComment.Text.Substring(0, my_index - 1);
}
m_ri.CommentContent.Content = m_txtComment.Text;
m_txtComment.Select(m_txtComment.Text.Length, 0);
}
边栏推荐
- 11 字符串函数
- 【Try to Hack】ip地址
- Tri rapide + Tri par bulle + Tri par insertion + Tri par sélection
- 这道字符串反转的题目,你能想到更好的方法吗?
- Decoding and practice of cmaf Technology
- 论文伪代码规范,伪代码在线编辑器,
- Intelligence Education - how to merge codes when code conflicts occur in multi person collaborative development?
- 帆软堆积图显示占比
- 抓包发现tcp会话中老是出现重复的ack和大量的tcp重传——SACK(Selective Acknowledgment, 选择性确认)技术
- [deep learning] [original] how to detect targets and draw map and other parameter maps without yolov5 weights or models
猜你喜欢

Interview questions of a company in a certain month of a certain year (1)

MIT CMS.300 Session 12 – IDENTITY CONSTRUCTION 虚拟世界中身份认同的建立 part 2

imperva-查找正则匹配超时的方法

php序列化和反序列化-ctf

Qt工程报错:-1: error: Cannot run compiler ‘clang++‘. Output:mingw32-make.exe

openni. utils. OpenNIError: (OniStatus.ONI_STATUS_ERROR, b‘DeviceOpen using default: no devices found‘

How MySQL converts a date to a number

测试apk-异常管控NetTraffic攻击者开发

HCIP之路MPLS

QT project error: -1: error: cannot run compiler 'clang++' Output:mingw32-make. exe
随机推荐
[markdown] markdown tutorial summary
Playwirght深度入门
【Veusz】导入CSV中的二维数据
For loop of go language foundation
Unity audio visualization scheme
mysql中多表视图性能疑惑
Deploy kubersphere in kubernetes
Playwirght getting started
YGG Spain subdao Ola GG officially established
vs在连接SQL时出现的问题myconn.OPen();无法运行
通过端口查文件
Chain tour airship development farmers' world chain tour development land chain tour development
MySQL系统表介绍
domain controller
Can you think of a better way to solve the problem of string inversion?
职场必备的30套报表模板,满足95%的报表需求,一键套用无需代码
Apache Solr 任意文件读取复现
The road to hcip MPLS
C WPF realizes dynamic loading of controls through binding
MySQL slow query record