把Button设为透明的方法:
1.修改 FlatAppearance属性下的BorderSize 为0
  修改 FlatStyle 的属性为 Flat

2.winform中按钮透明的方法

/// <summary>
/// 设置透明按钮样式
/// </summary>
private void SetBtnStyle(Button btn)
{
    btn.FlatStyle = FlatStyle.Flat;//样式
    btn.ForeColor = Color.Transparent;//前景
    btn.BackColor = Color.Transparent;//去背景
    btn.FlatAppearance.BorderSize = 0;//去边线
    btn.FlatAppearance.MouseOverBackColor = Color.Transparent;//鼠标经过
    btn.FlatAppearance.MouseDownBackColor = Color.Transparent;//鼠标按下
}
private void btn_MouseHover(object sender, EventArgs e)
{
    Button btn = sender as Button;
    btn.FlatAppearance.BorderSize = 1;
}

private void btn_MouseLeave(object sender, EventArgs e)
{
    Button btn = sender as Button;
    btn.FlatAppearance.BorderSize = 0;
}

 

lable可以直接使用label1.BackColor = Color.Transparent;使其透明

 

相关文章:

  • 2021-11-10
  • 2022-02-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-19
  • 2021-12-19
  • 2022-12-23
猜你喜欢
  • 2022-01-16
  • 2021-06-14
  • 2021-06-18
  • 2021-09-27
  • 2022-01-05
  • 2021-08-07
相关资源
相似解决方案