当前位置:网站首页>RichTextBox operation
RichTextBox operation
2022-07-24 22:29:00 【ima_ zhan】
</pre><p>1. Convert content to array </p><pre name="code" class="csharp">FlowDocument fd = richTextBox1.Document;
System.IO.Stream s = new System.IO.MemoryStream();
System.Windows.Markup.XamlWriter.Save(fd, s);
byte[] data = new byte[s.Length];
s.Position = 0;
s.Read(data, 0, data.Length);s.Close();2. Load contents from the array
System.IO.Stream news = new System.IO.MemoryStream(data);
FlowDocument newfd = System.Windows.Markup.XamlReader.Load(news) as FlowDocument;
richTextBox2.Document = newfd;3. command
Copy : ToolBarCopy.Command = System.Windows.Input.ApplicationCommands.Copy;
shear : toolBarCut.Command = System.Windows.Input.ApplicationCommands.Cut;
Paste : ToolBarPaste.Command = System.Windows.Input.ApplicationCommands.Paste;
revoke : ToolBarUndo.Command = System.Windows.Input.ApplicationCommands.Undo;
Restore : ToolBarRedo.Command = System.Windows.Input.ApplicationCommands.Redo;
Writing in the middle : toolBarContentCenter.Command = System.Windows.Documents.EditingCommands.AlignCenter;
The words are on the right : toolBarContentRight.Command = System.Windows.Documents.EditingCommands.AlignRight;
Words on the left : toolBarContentLeft.Command = System.Windows.Documents.EditingCommands.AlignLeft;
Arrange in order : ToolBarNumbering.Command = System.Windows.Documents.EditingCommands.ToggleNumbering;
Out of order : ToolBarBullets.Command = System.Windows.Documents.EditingCommands.ToggleBullets;In actual use, it is found that only such operation , Button cannot be clicked , Put the button on toolbar Li caike .
4. Set the color
System.Windows.Media.Color clr =
System.Windows.Media.Color.FromArgb(BkColor.A,BkColor.R,BkColor.G,BkColor.B);
richTextBox1.Selection.ApplyPropertyValue(TextElement.ForegroundProperty, new SolidColorBrush(clr));5. Set the font
richTextBox1.Selection.ApplyPropertyValue(TextElement.FontFamilyProperty,SelFnt);6. Set size
richTextBox1.Selection.ApplyPropertyValue(TextElement.FontSizeProperty, isize.ToString());isize Integer. 边栏推荐
- Moving least squares fitting experiment of PCL point cloud processing (62)
- Win10 solution Base64
- Backgroundworker enables time-consuming operations without affecting interface response
- DDoS attack classification
- Web3 security go + security
- When texturebrush is created, it prompts that there is insufficient memory
- ICML2022 | 图神经网络的局域数据增强方法
- The kettle job implementation runs a kettle conversion task every 6S
- One click compilation and installation of redis6.2.4
- PCL点云处理之pcd文件转txt文件(单个或多个批量转换)(六十三)
猜你喜欢

Gradle learning - getting started with gradle

Visual studio input! No prompt

The kettle job implementation runs a kettle conversion task every 6S

Sensor experiment - 485 air temperature and humidity

C # use SQLite

力扣 1184. 公交站间的距离

暴力递归——N皇后详解 && 如何用位运算进行优化

Gradle learning - gradle advanced instructions
![Cell special issue | application and future prediction of AI in protein structure, precision medicine, antibody therapy [review]](/img/2e/7f3cbae33c8a994b38e3bf4f9f13cb.png)
Cell special issue | application and future prediction of AI in protein structure, precision medicine, antibody therapy [review]

Projection regularization of line point set in PCL point cloud processing (56)
随机推荐
Maixll dock QR code recognition
Machine learning kmeans
VScode默认输出到调试控制台如何调整到终端以及两者中的乱码问题
How static code analysis works
Implementation of graph structure, from point to edge and then to graph
PCL点云处理之移动最小二乘拟合实验(六十二)
Morris遍历
DDoS attack classification
Filter list
聊聊 Redis 是如何进行请求处理
《JUC并发编程 - 高级篇》05 -共享模型之无锁 (CAS | 原子整数 | 原子引用 | 原子数组 | 字段更新器 | 原子累加器 | Unsafe类 )
Get the solution to the slow running speed of Mengxin Xiaobai computer! ٩ ( ‘ ω‘ )و get! ٩ ( ‘ ω‘ )و
Web3安全 Go+Security
PCL point cloud processing to find the two endpoints of the line point set (57)
《元宇宙2086》单日销量超《三体》 夺得京东图书单日科幻榜冠军
ansible-playbook 可用参数
头脑风暴之——利用reduce方法重构concat函数
QT learning vs creating QT items shows instances where object references are not set to objects
Kubernetes scheduling concept and workflow
图结构的实现,从点到边再到图