当前位置:网站首页>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. 边栏推荐
- Apipost signs up with Chinatelecom! Work together to accelerate the digital transformation of enterprises
- 对萌新小白电脑运行速度变慢解决的方法get!٩( ‘ω‘ )و get!٩( ‘ω‘ )و
- SVM - for linear separability (Part 2)
- PCL点云处理之直线点集投影规则化(五十六)
- Which is the best interface documentation tool at home and abroad?
- Kubernetes v1.24 is deployed based on containerd
- C# 使用SQLite
- PCD file of PCL point cloud processing to TXT file (single or multiple batch conversion) (63)
- Application programming of communication heartbeat signal for communication abnormality judgment
- PCL点云处理之边界提取(五十八)
猜你喜欢

Application programming of communication heartbeat signal for communication abnormality judgment

Helm —— 强大的 Kubernetes 应用的包管理工具

Plane regularization of PCL point cloud processing (55)

One click compilation and installation of redis6.2.4
![Luogu p2024 [noi2001] food chain](/img/7f/6ccbc19942f0d4a153025346496834.png)
Luogu p2024 [noi2001] food chain

Push information to wechat through enterprise wechat self built application

Go+ language

【1184. 公交站间的距离】
![Cell专刊|AI在蛋白结构、精准医疗、抗体疗法[综述]等的应用与未来预测](/img/2e/7f3cbae33c8a994b38e3bf4f9f13cb.png)
Cell专刊|AI在蛋白结构、精准医疗、抗体疗法[综述]等的应用与未来预测

Time series data in industrial Internet of things
随机推荐
CSF cloth simulation filtering for PCL point cloud processing (59)
有序表之AVL树
Is it safe to log in the securities account on the flush
Kubernetes scheduling concept and workflow
PCL点云处理之平面规则化(五十五)
Maixll dock QR code recognition
Filter list
ASP.NET Core 6.0 基于模型验证的数据验证
一种兼容、更小、易用的WEB字体API
Violent recursion - detailed explanation of Queen n & how to optimize with bit operation
IndexTree2D
一文读懂Elephant Swap的LaaS方案的优势之处
Homework of the 20th week
What are the methods of knowledge map relation extraction
单调栈结构
[cloud native] Devops (IV): integrated sonar Qube
Function default parameter pit avoidance Guide
Enterprise operation we media can't "self Hi": the content should be grounded, not advertising
单调栈结构练习——子数组最小值的累加和
Visual studio input! No prompt