Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » Interface and Graphics

Post new topic   Reply to topic
Changing colour and font in label caption
View previous topic :: View next topic  
Author Message
Mitesh2004
Freshman


Joined: 26 Jan 2004
Posts: 43

PostPosted: Mar 10th, 2004 10:23 AM    Post subject: Changing colour and font in label caption Reply with quote

Hello,

I have a label with the following code:

Code:
lblOSMissed.Caption = "Percentage of Overall Shots Missed: " & Format(1 - OverallShot**** / OverallShots, "percent")


How would i make only the actual pecentage at the end to appear Red and in Bold text?

I would appreciate any help. Cheers!
Back to top
View user's profile Send private message Send e-mail
Gilad_r
Centurion


Joined: 03 Mar 2004
Posts: 156

PostPosted: Mar 10th, 2004 12:22 PM    Post subject: Reply with quote

you wouldn't..Smile try using two labels:
one with the regular text and another with the red & bold text
_________________
"you should make amends with you" (Incubus)
Back to top
View user's profile Send private message
Mitesh2004
Freshman


Joined: 26 Jan 2004
Posts: 43

PostPosted: Mar 10th, 2004 01:09 PM    Post subject: Reply with quote

hmmmm.....

I dont really want to use a sepatate label. Are you positive that there is no other way to do this?

Isnt there some sort of function like Chr(vbKeyReturn) but for making text bold?
Back to top
View user's profile Send private message Send e-mail
P.T.A.M.
Administrator


Joined: 08 Oct 2003
Posts: 752
Location: Greece

PostPosted: Mar 10th, 2004 04:14 PM    Post subject: Reply with quote

Use a Rich Text Box with the Appearence =0 ,Borderstyle = 0 and Enabled =False. Change the backcolor also if you want. Then you can do :

[vb:1:114ba5d3fd]Private Sub Form_Load()
OverallShot = 7
OverallShots = 17
RichTextBox1.Text = "Percentage of Overall Shots Missed: " & Format(1 - OverallShot / OverallShots, "percent")
RichTextBox1.SelStart = 36
RichTextBox1.SelLength = Len(RichTextBox1.Text)
RichTextBox1.SelColor = vbRed
RichTextBox1.SelBold = True
RichTextBox1.SelStart = Len(RichTextBox1.Text)
End Sub[/vb:1:114ba5d3fd]
_________________
No one is completely useless. They can at least be an example of what to avoid.
Back to top
View user's profile Send private message Send e-mail Visit poster's website ICQ Number
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » Interface and Graphics All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic