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:
Download and Fork This Sample on GitHub
We proudly host our sample code on github.com/TextControl.
Please fork and contribute.
Requirements for This Sample
- Visual Studio 2017 or better
- TX Text Control .NET for Windows Forms (trial sufficient)
If you have any suggestions or comments please feel free to drop us a line.