C#Button重写 背景透明带有按键效果
推荐于2017-12-15 · 知道合伙人软件行家
关注
展开全部
/// <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;
}
/// 设置透明按钮样式
/// </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;
}
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询