Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Multi colored labels

Posted on 2009-05-07
2
Medium Priority
?
159 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 22

Accepted Solution

by:
danaseaman earned 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

618 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