Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Change Label Color On Mouse Over

Ei, gud day,

Just want to know how can a change the label's color when it got the focus of the mouse pointer and return to its previous color after the focus is lost.

tnx gud day

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
[VB6] Change Backstyle Of Label When Mouse Over Label
Hello everyone! I am using Microsoft Visual Basic 6. My project has a Form with a Label. How do I change the BackStyle of the Label from Transparent to Opaque when the mouse is over the Label and back from Opaque to Transparent when the mouse is not over the Label? My code follows...

VB Code:
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)    Label1.BackStyle = TransparentEnd Sub

That code changes the BackStyle of the Label from Transparent to Opaque when the mouse is over the Label, but does not change it back from Opaque to Transparent when the mouse is not over the label. How do I do this? Thank you!

Change Color On A Label
Hy, i would like to change color of label when mouse is on, but also refind the original one when mouse over. I tried différentes ways but no succed so far...
Any ideas ?

How To Change The Color Of A Label
What I'm looking for is how to change the backcolor of a label at run time. I want it to change color as the mouse passes over it. I can take care of the "as the mouse passes over it" part, but not the changing the backcolor part Thanks for any help!

Label Color Change
Hi all
I am changing color of label on mouse move event
But my question is how to get back the previous color when mouse in not on the label
Miss I want when mouse is on the label then its color is red otherwise previous color

See my code

VB Code:
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)Label1.BackColor = &HFF&End Sub


Array Of Color Label Does Not Change Vb6

I have an array of Label that are filled with data from a database and this when I click are being added to a listview and at the same time the Label becomes green. But what interests me is when I deleted from the listview an Item I need that the selected item from the label goes black

this is the code that i'm using

Dim i As Integer
For i = ListView1.ListItems.count To 1 Step -1
If ListView1.ListItems(i).Selected Then
ListView1.ListItems.Remove (i)

If ListViewDetalleMesa.ListItems(i).Selected Then
LabelArray(i).ForeColor = vbBlack

End If
End If

I appreciate a lot if someone can help me

Elvis Cabral

Change Label Back Color
I have wriiten a small proceduer for coloring the Label

Private Sub lblBox_Click()
Call ColorLabel(lblBox)
End Sub

Public Sub ColorLabel(ByVal strlabelName As String)
If strlabelName.BackColor = &H80000005 Then
strlabelName.BackColor = &H80000002
If strlabelName.BackColor = &H80000002 Then
strlabelName.BackColor = &H80000005
End If
End If
End Sub

Bu twhen i complie it gibes me invalid qualifier..please advice..

Can't Change Label's Font Color
I have a string variable that returns various RGB values in hexadecimal. (ex. FFCC22). I want the font color of a label to have an RGB value equal to the string variable.

The string variable changes, so I can't just set the color manually. I thought it would be simple, like 'Label1.ForeColor = sVariable'. That doesn't work. I looked into some of the tutorials, and it shows that it would have to be written 'Label1.ForeColor = RGB(255, 204, 22)'. I can think of a way to get from hex to the three numbers in the function, but it would take hundreds of variables and lots of code. It would be kind of a lot of work just to change the font color.

Is there an easy way to do what I want to do?

Change Label Border Color..
is there anyway to change a label's border color when its 2d?

How Can I Change The Label Color In An Array
that changes each label color blue, and leaves them blue.
How would you code it so only one label is blue? The one that is clicked on, or has the focus should be the only one that is blue.


Mouse Over The Label...change The MousePointer?
When I move the mouse over my label, I want my MousePointer change to Screen.MousePointer = 11 and when the mouse left the label the MousePointer should change to Screen.MousePointer = 0. How do I do that?

Change Label's Backcolor When Mouse Is On Top
hi all..
how can I make a label's backcolor changed when the mouse pointer is on top of it, and change the backcolor back when the mouse pointer leaves the label?

is there any simpler way instead of using the mouse_move method (using x and y)?


MouseMove Event To Change Label Color
I would like to make a label, that when the mouse is on top of it, the label color changes and goes back to the original color once the mouse is off the label.

Right now I'm using this:

VB Code:
Private Sub label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)label1.ForeColor = &H808080End Sub

and the same sort of event for the form so that it goes back to the original color. The problem with this is that my form has only a small space and sometimes when I move the mouse it misses the form.

Any other way of doing it?

Clicking Through Label (or Disabled Label Color)
I'm having some trouble with a game I'm working on. I have image boxes that change color when they are clicked. Each image box has a label over. As it is now, you have to avoid clicking on the label in order to change the color of the image box. If I disable the label, then you can't even see it because of the color. Seems as though there is no way to change the disabled color, right. I need the label to remain on top, with an invisible background after the image box color changes. Is there anyway I can tell the program to ignore the labels? Or any other ideas on how to do this? THANKS!

Unresolved - Can You Change The Menu Bar Color On Forms && The Face Color On SSTabs?
Is there a way to change the menu bar color on particular forms during runtime? I only have 1 form open at any any given time in my app... Also, is there a way to change the back color of an SSTab control during runtime so that the entire surface of the SStab is the new color?? When I change the back color it doesn't change the color of the active SSTab face, but only the color behind the tabs somewhere, as I can see the new color barely displayed between the SSTab tabs.


Edited by - ddutke on 2/18/2005 1:42:53 PM

DataReport: Change Label At Runtime / Event On Page Change
I have a datareport connected to a dataenviromnent. I want to put a label which should show calculated value in it. So I need to use some event which fires when the page changes. Is this possible?


For Datepicker How Can I Change The That Highlight Color To Anither Color
assume that I name datepicker1 to dttime, whenI click on that the default color is blue, cani change to to yellow etc?

How To Change SSTab Color (Form Not Back Color)
I hope someone can help me problem .I want to change SSTab Color user define.I do not want to change backcolor.

Popupmenu Background Color Change As Well As Font Size Change
hi folks
am creating one popupmenu using createpopupmenu() API
and also i insert items dynamically using insertmenuitem API
and display using Trackpopupmenu().
My problem is

1)i want to change the background color of popup menu?????
2 i want to change the font size in popup menu ???????
dynamically .
if any body know API or how to change the font size and change the background color in popupmenu ,please help ur friend.

I don't need menu editor.
i need only popup menu.
expecting a positve reply.

Msg Box; How Do I Change The Font Color And Background Color
I want a message box to pop up whenever someone opens a file. Further, I want to change the fill colors from grey and blue to something else, and I want to change the color of the fonts. Any suggestions?

Color {change Button Color}
This seems like a stupid question but how do you change the text colour on buttons in vb? i have changed the button color but need to also change the text colour to white, anyone?

Turn Label A Color
I have a probelm with certain bits of code not executing or at least not in a way that anyone can see. An example would be this

Label1.ForeColor = vbRed
'a bunch of stuff
Label1.ForeColor = vbGreen

The Label will turn a block of white equal to the size of the area of the Label. At the end it will turn green as requested. Any ideas as this happens in all my projects when I try something like this inc color and even label captions. BTW the label is drawn directly on the form


MouseMove Label Color
How can you make a label caption change colors from Red to Blue with a MouseMove code? Using the basics, the following works once but doesn't allow the original color to redisplay.

When the form opens, Label1 displays with Red color for the caption. On the MouseMove, Label1 becomes invisible and Label2 with Blue caption displays. Obviously, this isn't the best way since the original Red cannot be redisplayed. What would be? THANKS.

Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label2.Visible = True
Label1.Visible = False

Label Font Color
if i have a label in my project and it is somthing like this
label1 = "test test " & text1.text & " test test"
how would i make the test words black and the text1.text font red

Label Border Color
is there a way to control the color of the border of a label.
It's always BLACK

Label Caption Color?
I did something that I cant undo, all the captions on all my labels on all forms turned to blue and my option buttons all have black surrounding them?

Label (Disabled Color) ???
Hi everybody !

In the picture below, there's a difference between the "enabled color" of checkbox and label..

Is it possible to change the "enabled color" of a label ???

Thanks in advance !

Changing The Label Color
Dear Team,
Is it able to change the caption of Label Box Partially.That is if the caption is "this is test", How can I change the color of "test" to red and the remaining to defalut.

Label Backgroound Color
I have an image who's background color is described by RGB weights as (154, 154, 154). How can I set a label background to match this exactly?

Changing The Color Of A Label
This detects when I'm moving the mouse over the labels in the array. It changes the color of the label text to red.
But how do you make the color of the labels return back to normal when your mouse isn't over them anymore????

Private Sub Label4_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Label4.Item(Index).ForeColor = vbRed
End Sub

MouseMove - Label Color

I'm using images with transparent labels laid over the top of them for the
caption instead of command buttons. I'm told this uses fewer system
resources. What I want to do is make the label caption color change to white
when the mouse is moved over the label and change back to the original color
as the mouse is moved off of the label. I used the following code which does
make the color change. The problem is when the mouse is moved off of the
label, the color remains white and doesn't change back to it's original
color. I don't know what is missing here.

Private Sub lblButton_MouseMove(Label As Integer, Shift As Integer, X As
Single, Y As Single)
Me.lblbutton.ForeColor = vbWhite
End Sub

Any suggestions are greatly appreciated.


Label Text Color

I have a frame on my form and I wanted to put some labels inside it.

Unfortunately the labels won't remain on top of the frame so I had to use text boxes.

I don't want the user to be able to select the text or edit it in any way.

I've disabled the text boxes but now my text is gray which doesn't fit in with the context of my application.

Any suggestions would be much appreciated.

Best regards,

Rob Brown.

Label Font Color
Is there a way to change the fore color or back color of a label when the mouse is moved across it or some other way of showing the user which label the mouse is on?  

Possible To Have Different Color Text In A Label??
Is it possible to have a label with different color text? (ie) "This is a test message"

If so, how would one go about implementing this?

Thank you.

Mouse Over Effects On A Label ?
I've had a look around here and tried the code examples for creating mouse over effects, I put my label inside a pic control and it works kinda !? well basically its fine as long as I leave a big border area around my label inside the picture control, otherwise if I make my picture box small, it doesn't always register an event has occured, but this is ugly as I now have to space items so far apart (I want to place several "Links" on my form), does anyone know a better way or a more direct method to deal with labels ?

Label 'mouse-over' Event
I have a label (from the control toolbox) that contains some text.

I would like to create a 'mouse-over' type event, e.g. the text within the label inreases in size when the mouse pointer is held over the label, and then reverts back to normal when the mouse pointer is moved away.

Is this possible ?

Any help is greatly appreciated.

Mouse Pointer Over A Label
is there a way to display a control whil the mouse is over a label ? Kind of like the tool tip but with a control ?

Mouse Move On Label (VB6)
have 2 label, label1 and label2 in a form
how to use mousemove event for label1 and label2 with blu and red color.

Color Of Access Key Of Label Object
How can I change the color of Access Key of Label Object

Is thre any solution to change the color or access kay of an object when we use '&' with a label caption or menu object, underlines is displayed on particular character I want to change the color of that character instead of default underline. Is it possible ?

Changing Font Color In A Label

I been trying to change the font color in my label. I know what the color is in Photoshop. The rgb is 37,37,119 and the hex is 252577.

So in my code I have "label1.forcolor = &H00252577" this changes the font color but its not the color I need.

I also tried changing this in the properties for the label but I cant get the color to match the rgb values found in PS.

Any help appreciated.

Disabled Label Font-Color
When a label is disabled the font-color will be dark-gray, is it possible to change that font color? Let say in red.



I Want To Click On Every Of 20 Labels And That That Label Changes Color! How?????????
Please, answer as soon as posible!!!!! I`m fresh in all this.
I have about 20 labels. How could I make that everytime I click on one of the labels that label changes backcolor, but I don´t want to write that code[Label1.backcolor=rgb(255,0,0) ;Label2.backcolor=rgb(255,0,0) etc.] for every label. Is there quicker way???!???!?!???!

Label && Textbox Border Color ?
hi everybody !

Is there any code to give a textbox and a label a border color ?

Thx !

Remember Label Color [RESOLVED!]
Im using a command button and a color dialog. Once you click the cmd button, you select a color and it makes all labels in my project change into that color. Anyway i need to know how to write this into an ini and read it when the program is opened again. So say, i set the labels to pink, close the app and reopen it, the labels are pink.

Anyone have any ideas?


Setting A Hex Or Rgb Color To The Forecolor Of A Label
I've been asked to use a specific color for the forecolor for some labels.  I've been give the color in RGB and Hex format.

I've tried:
label.forecolor=&h003266 to no avail.  The color should be blueish but it looks a good bit darker than the sample provided.  Is there a way to do this and get the color that is being asked for?

i've searched RGB and hex Color and read some threads like this one thread222-1375356: How to retrieve the RGB from a HEX number? but i'm still a little confused.

How Do You Highlight A Label When You Scroll Over It With Mouse?
In access 2000, I have a form with 20 labels on it that the user click on to select a report.

How do I get the label to change it's format so that it is bold or highlighted when the user scrolls over it with their mouse? Because right now it is not clear if they have selected anything until the report shows up.

If you have any suggestions, let me know.


Highlighting Label Text When Mouse Is Over...
Hey again guys, gots another question..

I got another command button that I am using in a different form that I want labels to show below it when you click on it. The problem is, this command button is in a frame, and when I click the command button, the labels appear outside the frame, not being where they are suppose to..

So what do I have to do to get the labels to appear in the frame?

Highlighting Label Text When Mouse Is Over...
Hey everyone, for some reason, the mousemove event isnt being triggered. I am creating two labels through code, not through design time, so that is probably why it isnt working right.

Here is the code:

Private Sub cmd_Edit_Click()

Set lbl_EditText = Controls.Add("VB.Label", "lbl_EditText")
Set lbl_ChangeTime = Controls.Add("VB.Label", "lbl_ChangeTime")

With lbl_EditText

.Height = 230
.Width = 1200
.Left = cmd_Edit.Left
.Top = cmd_Edit.Top + 383
.Appearance = 0
.BackColor = vbWhite
.BackStyle = 1
.BorderStyle = 1
.ForeColor = vbBlack
.Enabled = True
.Alignment = 2
.WordWrap = False
.AutoSize = False
.Caption = "Edit Text"
.Visible = True

End With

With lbl_ChangeTime

.Height = 230
.Width = 1200
.Left = cmd_Edit.Left
.Top = lbl_EditText.Top + 230
.Appearance = 0
.BackColor = vbWhite
.BackStyle = 1
.BorderStyle = 1
.ForeColor = vbBlack
.Enabled = True
.Alignment = 2
.WordWrap = False
.AutoSize = False
.Caption = "Change Time"
.Visible = True

End With

End Sub

Private Sub lbl_EditText_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

With lbl_EditText

If (X < 0) Or (Y < 0) Or (X > .Width) Or (Y > .Height) Then

.ForeColor = vbBlack


.ForeColor = vbBlue

End If

End With

End Sub
The labels come up fine, its just that the lbl_EditText_MouseMove event doesnt fire.

So if anyone can help me out or has any suggestions, that would be great. Thank you!

Label Drag - Mouse Jumps
Ok, here's my code for starters:

Private Sub flxPlayList_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'Start Drag if there's more than one row and the left-button was clicked (not for right-click)
If Button = 1 And flxPlayList.MouseRow > 0 Then
lblDrag.Caption = flxPlayList.Name
'Move: Left, Top, Width, Height
lblDrag.Move flxPlayList.Left + 40, _
flxPlayList.Top + flxPlayList.RowPos(flxPlayList.Row) + 40 + (flxPlayList.RowHeight(1) / 2), _
flxPlayList.ColWidth(0) + flxPlayList.ColWidth(1), _
lblDrag.Drag ' Drag label outline.
End If
End Sub

The annoying thing is, as soon as you click, the lable outline appears just where I want it, but the mouse jumps to the center of it. Why can't the mouse just stay where it is???

Show A Label At Mouse Position ??
Any ideas ?? I cant see mto get it to work with mousemove...



Copyright © 2005-08, All rights reserved