Solved

Multi colored labels

Posted on 2009-05-07
2
157 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 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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

707 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