[Question]Make RTB have multiple formats.

Discussion in 'Archives' started by Markizano, May 7, 2007.

[Question]Make RTB have multiple formats.
  1. Unread #1 - May 7, 2007 at 10:41 AM
  2. Markizano
    Joined:
    Mar 2, 2006
    Posts:
    100
    Referrals:
    0
    Sythe Gold:
    0

    Markizano Active Member
    Banned

    [Question]Make RTB have multiple formats.

    OK...I know how to create a RichTextBox and place it in my form, I know how to change the font and all that, but what I want to know is how can I make only certain words have certain formats.

    An example of this outcome would be Visual Basic itself and particularly SCAR. Once the word is typed in the TextBox in SCAR, the format is applied. Here's a visual:
    [​IMG]

    Does anyone know how to repeat this effect?

    Markizano
     
  3. Unread #2 - May 7, 2007 at 10:56 AM
  4. speljohan
    Joined:
    Apr 24, 2005
    Posts:
    1,450
    Referrals:
    3
    Sythe Gold:
    0

    speljohan Guru
    Visual Basic Programmers

    [Question]Make RTB have multiple formats.

    Syntax Highlights (Coloring). I don't believe it can be done with just a RichTextBox. I think you have to use a custom control.
     
  5. Unread #3 - May 7, 2007 at 11:59 AM
  6. Markizano
    Joined:
    Mar 2, 2006
    Posts:
    100
    Referrals:
    0
    Sythe Gold:
    0

    Markizano Active Member
    Banned

    [Question]Make RTB have multiple formats.

    I think it would be possible since a RichTextBox can support multiple formats in the box. It would just be helpful to know how to make this happen.

    EDIT:
    Here's the code that is in the RichTextBox1.TextRTF, I think that this might help some ppl help me figure this out:
    Code:
    {\rtf1\ansi\deff0\deftab720{\fonttbl{\f0\fswiss MS Sans Serif;}{\f1\froman\fcharset2 Symbol;}}
    {\colortbl\red0\green0\blue0;}
    \deflang1033\pard\plain\f0\fs17 
    \par }
    
    It looks kinda similar to Java, although I doubt it is; what with the brackets and all.
     
  7. Unread #4 - May 7, 2007 at 9:09 PM
  8. Covey
    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    [Question]Make RTB have multiple formats.

    i could possibly do it, but you would need a list of words to loop through etc and it would make it laggy =\.
     
  9. Unread #5 - May 8, 2007 at 9:43 AM
  10. Markizano
    Joined:
    Mar 2, 2006
    Posts:
    100
    Referrals:
    0
    Sythe Gold:
    0

    Markizano Active Member
    Banned

    [Question]Make RTB have multiple formats.

    I ended up finding it. *Sigh*
    [​IMG]
    Thanks to Speljohan, i learned the name of the thing i was trying to do: Syntax Highlighting. Thanks Spel.

    If anyone cares, here's the link to the source code to the program that "colourizes" the text. Scroll down and you can dl the project and study it yourself.
    http://www.codeguru.com/vb/gen/vb_misc/text/article.php/c2733/

    and if you don't feel like opening a new window/tab or just don't feel like searching thru a page to find a link...here it is as well:
    http://www.codeguru.com/code/legacy/vb_misc/1799_vbscolour.zip

    Thanks for help and Enjoy the project ;) :D
     
  11. Unread #6 - May 10, 2007 at 9:00 PM
  12. joewnn
    Joined:
    Apr 21, 2005
    Posts:
    1,500
    Referrals:
    0
    Sythe Gold:
    0

    joewnn Guru
    Banned

    [Question]Make RTB have multiple formats.

    SCAR uses a Delphi only component, so you will have to use a user control in VB6. It will be slower in vb of course, so good luck.
     
< Selling 4 pins 900k ea.. | Jansen The Administrator! >

Users viewing this thread
1 guest


 
 
Adblock breaks this site