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. Syntax-Hilighting

Syntax-Hilighting

Scheduled Pinned Locked Moved C#
csharpphphtmlvisual-studioxml
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.
  • D Offline
    D Offline
    DigitalKing
    wrote on last edited by
    #1

    Hi, I'm overriding the RichTextBox class to add syntax-highlighting functionality (HTML, XML, PHP, C). So far, I've been very successful. I have a working version with just a few bugs. The only problem that I've run in to is that when the user opens a file, the process is very slow. This is because to change the color of the text, I am using the RichTextBox's Select method to select a range of text, and then setting the field SelectionColor. If I open a file with many lines, this process takes a few seconds to complete. I notice that when I open a similar file in Visual Studio, the syntax-highlighting is instantaneous. So, I was wondering if there's a faster way to change the color of many portions of text in the RichTextBox (without selecting it first). Is this possible using Windows Messages or Win32 Functions? Thanks in advance. DigitalKing

    D 1 Reply Last reply
    0
    • D DigitalKing

      Hi, I'm overriding the RichTextBox class to add syntax-highlighting functionality (HTML, XML, PHP, C). So far, I've been very successful. I have a working version with just a few bugs. The only problem that I've run in to is that when the user opens a file, the process is very slow. This is because to change the color of the text, I am using the RichTextBox's Select method to select a range of text, and then setting the field SelectionColor. If I open a file with many lines, this process takes a few seconds to complete. I notice that when I open a similar file in Visual Studio, the syntax-highlighting is instantaneous. So, I was wondering if there's a faster way to change the color of many portions of text in the RichTextBox (without selecting it first). Is this possible using Windows Messages or Win32 Functions? Thanks in advance. DigitalKing

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      There are no Win32 or Message functions you can use to speed this up. The problem is that you're using the worst control you can to do this. The RichTextBox does not lend itself well to syntax highlighting. Unfortunately, it's also the easiest to use without writing your own TextBox class to support this. You may want to do some research by chekcing out these[^] articles to see if you can pick up a faster technique. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      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