I have a RichTextBox control on my form. I also have this button, labeled Bold, that I want, if someone selects text in the RichTextBox, then presses the button, the selected text turns bold. Any way to do that? Simple, everyday task for end users. Thanks.
相关问题
- How to know full paths to DLL's from .csproj f
- Importing NuGet references through a local project
- Visual Studio 2019 - error MSB8020: The build tool
- 'System.Threading.ThreadAbortException' in
- how to use special characters like '<'
相关文章
- vb.net 关于xps文件操作问题
- How to show location of errors, references to memb
- How to track MongoDB requests from a console appli
- Sort TreeView Automatically Upon Adding Nodes
- Where does this quality loss on Images come from?
- Visual Studio Hangs on Loading UI Library
- How to use Mercurial from Visual Studio 2010?
- Checking for DBNull throws a StrongTypingException
A variation on the above that takes into consideration switching bold on/off depending on the currently selected text's font info:
It may need cleaned up a bit, I pulled this from an older project.
You'll want to use the .SelectionFont property of the RichTextBox and assign it a Font object with the desired styles.
Example - this code would be in the event handler for the button: