Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Rich Text Box

Rich Text Box

Scheduled Pinned Locked Moved C#
csharphelpannouncement
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Johnnny
    wrote on last edited by
    #1

    Hi All I am having propblems moving from the vb6 version Rich Text Box (RTB) to the .NET one. 1. The .NET version RTB seems to have stripped a lot of the properties and moved them to the font property. This is a problem when you have multiple fonts selected and can no longer access these previous properties independently. The properties are: * SelSize (The font size of the selection) * SelBold (Whether the selection is bold or not) * SelItali (Whether the selection is italic or not) I can retrieve these properties by regexing the actual Rich Text but I would have thought there was an easier way.:( TIA JB Not Bitter, Just Twisted

    J 1 Reply Last reply
    0
    • J Johnnny

      Hi All I am having propblems moving from the vb6 version Rich Text Box (RTB) to the .NET one. 1. The .NET version RTB seems to have stripped a lot of the properties and moved them to the font property. This is a problem when you have multiple fonts selected and can no longer access these previous properties independently. The properties are: * SelSize (The font size of the selection) * SelBold (Whether the selection is bold or not) * SelItali (Whether the selection is italic or not) I can retrieve these properties by regexing the actual Rich Text but I would have thought there was an easier way.:( TIA JB Not Bitter, Just Twisted

      J Offline
      J Offline
      Judah Gabriel Himango
      wrote on last edited by
      #2

      Would the following work for you?

      Font regularFont = this.richTextBox1.Font;
      Font boldFont = new Font(regularFont, FontStyle.Bold);
      Font italicFont = new Font(regularFont, FontStyle.Italic);

      // instead of SelBold
      this.richTextBox1.SelectionFont = boldFont;

      // instead of SelItali
      this.richTextBox1.SelectionFont = italicFont;

      ... and so on

      #include "witty_sig.h"

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups