Products Technologies Demo Docs Blog Support Company

TX Text Control Format Painter Sample Released

We have recently been asked if TX Text Control has a similar feature as Microsoft Word's Format Painter feature, so we decided to create a new sample project for our valued customers. In this project, we use a context menu to provide the option to copy text formatting. If you like, you can also use a button, it's up to you. You will notice that text formatting information can only be saved if the selection contains only the same formatting, e.g. if the whole selected text has the same font,…

TX Text Control Format Painter Sample Released
Text Control

We have recently been asked if TX Text Control has a similar feature as Microsoft Word's Format Painter feature, so we decided to create a new sample project for our valued customers.

In this project, we use a context menu to provide the option to copy text formatting. If you like, you can also use a button, it's up to you.

You will notice that text formatting information can only be saved if the selection contains only the same formatting, e.g. if the whole selected text has the same font, font size, is bold, and so on. This is due to the fact that we need a defined return value, which would not be the case if the selection would contain different fonts or font sizes. Here comes the IsCommonValueSelected function into play, which we use to check the selection on same attributes.

You can download the sample from our Source Code Library.

If you have any suggestions or comments please feel free to drop us a line.

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

GitHub

Download and Fork This Sample on GitHub

We proudly host our sample code on github.com/TextControl.

Please fork and contribute.

Download ZIP

Open on GitHub

Open in Visual Studio

Requirements for this sample

  • Visual Studio 2017 or better
  • TX Text Control .NET for Windows Forms (trial sufficient)

Related Post

C#Indent.NET

Table Indent Alignment Sample Available

Sometimes, if you insert a table into existing text, you would like to align the table to the paragraph indent. Of course, this task can be done manually, but I thought it would be a good idea to…