设置btn FlatStyle为: Flat
设置btn背景为:Transparent
更彻底的话就要使用如下方法————
/// <summary> /// 设置透明按钮样式 /// </summary> private void SetBtnStyle(Button btn) //在Form1_Load时候调用 { 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;
}
来自: