当前位置:网站首页>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. 边栏推荐
- Helm -- a powerful package management tool for kubernetes applications
- Segment tree,,
- Let‘s Encrypt
- "Yuan universe 2086" outsold "San ti" in one-day sales and won the champion of JD books' one-day science fiction list
- One click compilation and installation of redis6.2.4
- Implementation of graph structure, from point to edge and then to graph
- Apipost签约中国电信!携手加速企业数字化变革
- Local data enhancement method of icml2022 | graph neural network
- Joint search set structure
- ASP.NET Core 6.0 基于模型验证的数据验证
猜你喜欢

Monotonic stack structure exercise -- cumulative sum of minimum values of subarrays

Esp32485 air temperature and humidity test

Visual studio input! No prompt

A compatible, smaller and easy-to-use web font API

AC自动机

"Yuan universe 2086" outsold "San ti" in one-day sales and won the champion of JD books' one-day science fiction list

工业物联网中的时序数据

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

从暴力递归到动态规划,记忆化搜索

PCL点云处理之均匀采样抽稀(六十一)
随机推荐
From Fibonacci sequence to matrix fast power technique
One click compilation and installation of redis6.2.4
ASP.NET Core 6.0 基于模型验证的数据验证
Flex layout
PCL点云处理之移动最小二乘拟合实验(六十二)
Apipost signs up with Chinatelecom! Work together to accelerate the digital transformation of enterprises
洛谷 P2024 [NOI2001] 食物链
How static code analysis works
IndexTree2D
Backgroundworker enables time-consuming operations without affecting interface response
Available parameters of ansible Playbook
What do GB, MB and KB mean respectively. What are the sizes
Which is the best interface documentation tool at home and abroad?
CSF cloth simulation filtering for PCL point cloud processing (59)
QT学习之VS创建QT项目显示未将对象引用设置到对象的实例
Plane regularization of PCL point cloud processing (55)
Gradle learning - gradle advanced instructions
ASP. Net core 6.0 data validation based on model validation
Use kettle to read the data in Excel file and store it in MySQL
"Fundamentals of program design" Chapter 10 function and program structure 7-3 recursive realization of reverse order output integer (15 points)