Results 1 to 6 of 6

Thread: Hard Question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Ca
    Posts
    106
    how do i change the color of selected words? for example, when user wants to change the fontcolor into blue during his editing... the font will be blue starting from then... so that the texts that the user wrote before will stay the same but the new texts will be blue

  2. #2
    Guest
    You mean when using a RichTextBox? If so, the following should work.
    Code:
    RichTextBox1.SelColor = vbBlue

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Ca
    Posts
    106
    thanks for the reply... i guess it was only hard for me

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Ca
    Posts
    106
    to make it a little more interesting, how do i show the color palette if the user clicks a button?

  5. #5
    Guest
    Add the following code to a Form with a CommonDialog and a RichTextBox
    Code:
    Private Sub Command1_Click()
        CommonDialog1.Color = RichTextBox1.SelColor
        CommonDialog1.ShowColor
        RichTextBox1.SelColor = CommonDialog1.Color
        RichTextBox1.SetFocus
    End Sub

  6. #6
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    Add a CommonDialog and name it Dialog. Now add this code to the command button:
    Code:
    Dialog.ShowColor
    RichTextBox1.Selcolor = Dialog.Color

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width