当前位置:网站首页>A solution to the problem that there is always a newline character when C merges multiple RichTextBox contents
A solution to the problem that there is always a newline character when C merges multiple RichTextBox contents
2022-06-13 07:14:00 【gc_ two thousand two hundred and ninety-nine】
Previous post 《C# Merge to show multiple richtextbox and textbox Control 》 Describes how to put different richtextbox Control contents are merged together , Without changing the content format . But in practice , Put two richtextbox The contents of the control are merged and displayed in another richtextbox In the middle of the day , It always appears as two lines , Instead of putting two paragraphs together , The results are shown in the following figure :
Debugging program , Look at the first one richtextbox Medium rtf Content ( As shown below ),rtf Last self-contained content \r\n A newline , At first, I thought this was the reason , In splicing rft Before the content , call string.TrimEnd Function to get rid of \r\n, But it didn't work , After splicing the content, it will still become two lines .
“{\rtf1\ansi\ansicpg936\deff0\nouicompat\deflang1033\deflangfe2052{\fonttbl{\f0\fnil\fprq2\fcharset0 GDT;}{\f1\fnil\fcharset134 Microsoft YaHei UI;}}\r\n{\*\generator Riched20 10.0.17763}\viewkind4\uc1 \r\n\pard\kerning2\f0\fs21 xyz\kerning0\f1\fs18\lang2052\par\r\n}\r\n”
Then check richtextbox Control properties or functions , See if there are properties or functions that control line wrapping , The first thing we found was WordWrap attribute , This property indicates whether the multiline edit control automatically wraps lines , The default value is True, Change the attribute value to False, rerun routine , It is still spliced into two sections .
Then hold a try mentality , take richtextbox Medium Multiline Property changed to False, This property controls whether the text of the edit control can span multiple lines , From the description of attributes , I can't see that this attribute will automatically insert line breaks between different contents , But will Multiline Property changed to False after , Then execute the procedure , You can combine the two paragraphs into one line . Because there will be no multi line situation in actual use , There is no need to worry about the situation where two paragraphs are put together in more than one line .
The above tests are used VS Self contained richtextbox Control , If you use dev Control richtextbox Control , Its document Built in attribute appendrtf and appendtext Function can automatically merge the contents together without newline .
边栏推荐
- SDN basic overview
- [Markov chain Monte Carlo] Markov chain Monte Carlo method sampling prior distribution
- Real time lighting of websocket server based on esp32cam
- MySQL query timeout control
- 杭州证券开户是安全的吗?
- Tidb implementation plan -- I
- 玄武云科技通过上市聆讯:业绩波动明显,陈永辉等三人为控股股东
- 领先企业的管理实践证明,企业可持续发展的核心是什么?
- [Tencent Alibaba's most comprehensive collection of test questions] (four sides: three rounds of technology +1 round of HR)
- Interview questions must be asked - Optimization of large table Pagination
猜你喜欢
随机推荐
SDN基本概述
玄武云科技通过上市聆讯:业绩波动明显,陈永辉等三人为控股股东
测试开发程序员,你还在迷茫吗?不能把自己定义为码农......
C Advanced Programming - features
C # related knowledge points
Priority analysis of list variables in ansible playbook and how to separate and summarize list variables
快速排序
关于oracle的函数。
2022-06-12:在N*N的正方形棋盘中,有N*N个棋子,那么每个格子正好可以拥有一个棋子。 但是现在有些棋子聚集到一个格子上了,比如: 2 0 3 0 1 0 3 0 0 如上的二维数组代表,一
Tidb index optimization
Xuanwu cloud technology passed the listing hearing: the performance fluctuated significantly, and chenyonghui and other three were the controlling shareholders
Introduction and use of dumping
Ml: introduction to stability analysis of machine learning model and detailed introduction to common solutions
Calculate running total / running balance
Tidb data migration (DM) Introduction
[weak transient signal detection] matlab simulation of SVM detection method for weak transient signal under chaotic background
Test development programmers, are you still confused? You can't define yourself as a yard farmer
SDN basic overview
Implementation of fruit mall wholesale platform based on SSM
Performance tuning can't just depend on tapping the brain









