简体   繁体   中英

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

在此输入图像描述

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;
    !
}

选择标签然后转到autosize并将其设置为false ...然后根据需要增加标签的长度...然后应用上面的代码......它会工作..一切都很好......

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;
           ...
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM