Solved

Multi colored labels

Posted on 2009-05-07
2
152 Views
Last Modified: 2012-05-06
I need to display a label about 45 characters in length.  It needs to alternate certain letters using two colors.
For example "On the first Friday..."  I need all letters to be white by default and the n and both t's to be grey.  I do not mind using multiple labels so long as the spacing somehow justifies so the spacing does not look strange.  Please provide a sample routine that can accept a string, Thank You.

I also have a routine that uses DrawString.  VB5 does not like that or the dim statements assigning a new font in the same instruction.  If you can provide a substitute for the instructions below that VB5 will accept and I can get it to work (or your own routine), I will still award you all the points, Thank You

     Dim DefaultFont As New Font("arial", 10, FontStyle.Regular)
      Dim BlueString As New SolidBrush(System.Drawing.Color.Blue)
      Dim RedString As New SolidBrush(System.Drawing.Color.Red)
      Dim gr As Graphics
      Dim OfficeIdentifier as string = "Office:"
      Dim LocationIdentifier as string

      LocationIdentifier = "Toronto"

      gr = LabelOffice.CreateGraphics
      gr.DrawString(OfficeIdentifier , rf, BlueString , 1, 1)
      gr.DrawString(LocationIdentifier , rf, RedString , 40, 1)

0
Comment
Question by:GarySB
2 Comments
 
LVL 22

Accepted Solution

by:
danaseaman earned 500 total points
ID: 24330255
See this free Formatted Label control which allows HTML style tags which can change Font attributes and colors.

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=34507&lngWId=1


0
 

Author Closing Comment

by:GarySB
ID: 31579086
Thank You!!! I updated to vb6 since I needed the additional functionality.  It Works!!!
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now