Logo
English Russian German French Spanish Italian
contact usprivacy
   Support Forums
chart
• Adjust flexgrid cell
• Animation
• Centering form text
• Coffee machine
• Creating fileshares
• Creating shortcuts
• Custom buttons
• Directory browser
• Disable mouse events
• File search by ext
• File transfer
• File watcher
• Formatting flexgrid
• Get Content Type
• Get HTML source
• Get modem port
• HTTP proxy
• ipconfig
• Large file split/merge
• MAPI
• MCI Sound Player
• Menu with images
• MP3 normalizer
• Net Send
• Netstat 2000
• No duplicate entries
• Outlook Address Book
• Set font color
• Shapes
• SOAP test
• Text-to-image
• Text file viewer
• Text find/replace
• UPS component
• View NT groups
• Word template
• Writing DNS control
    • Using DNS control
• Writing SMTP control
    • Sending email
    • Mailing list
• Writing WhoIs control
    • Using WhoIs control
• View HTML source
VB projects - Set font color in RichTextBox

Description: using RTF to change RichTextBox font color
Minimum requirements: VB6
Download: source code
Screenshot:
VB projects - Set font color in RichTextBox
Project: EXE
Controls: ComboBox cmb (Style = 2 'Dropdown List), RichTextBox rtf
Additional references: none
Code:
Option Explicit

Dim sColors As String

Private Sub cmb_Click() Dim s As String s = Hex(QBColor(cmb.ListIndex)) s = String(6 - Len(s), "0") & s rtf.SelStart = 0 rtf.SelLength = Len(rtf.Text) rtf.SelColor = vbWhite rtf.SelRTF = "{{\colortbl;\red" & Val("&H" & Right(s, 2)) & "\green" & Val("&H" & _ Mid(s, 3, 2)) & "\blue" & Val("&H" & Left(s, 2)) & ";}" & "{\highlight1 " & rtf.Text & "}}" End Sub
Private Sub Form_Load() Dim i As Integer For i = 0 To 15 cmb.AddItem i Next cmb.ListIndex = 0 End Sub

Copyright © 1996-2008 OstroSoft. All rights reserved. info@ostrosoft.com