Sahal Zaman
Sahal Zaman

Reputation: 255

How to change background Color of label full length when Mouse Hover in c#

I can't Select label back Ground color Mouse Hover event in full length,only can select The Word length

enter image description here

I would like to get log out background same like username background as full width

private void label5_MouseHover(object sender, EventArgs e) {
    this.LblChange.BackgroundImage = null;
    this.LblChange.BackgroundImage = global::Flex.Properties.Resources.Mail1;
    this.LblChange.BackColor = Color.Blue;
    this.LblChange.BackgroundImageLayout = ImageLayout.Stretch;
    !
}

Upvotes: 4

Views: 1370

Answers (2)

Rishad Appat
Rishad Appat

Reputation: 1808

select the label then goto autosize and set it to false... then increase the length of the label as much as you want... then apply your above code... it'll work.. All the best...

Upvotes: 2

apomene
apomene

Reputation: 14389

you need to change label5 color:

private void label5_MouseHover(object sender, EventArgs e)
{ ...
  label5.BackColor = Color.Blue;
  ...
}

or alternatively you need to define LblChange Mouse hover event:

private void LblChange_MouseHover(object sender, EventArgs e)
{
           ....
                this.LblChange.BackColor = Color.Blue;
           ...
}

Upvotes: 0

Related Questions