winform中的图标按钮布局 [英] Icon button layout in winform

查看:52
本文介绍了winform中的图标按钮布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Windows 8,VS 2012.我在按钮上添加了一个圆形图标:

I'm working on Windows 8, VS 2012. I added a round icon to my button:

this.btn.Image = Properties.Resources.icon;
this.btn.Size = Properties.Resources.icon.Size;

我的表单也有背景图片:

Also my form has background image:

this.BackgroundImage = Properties.Resources.sunset;

但是我的图标很丑,我的图标按钮是方形的:中间的圆形图像和角落里的灰色.

But I'm getting ugly form, where my icon button is square: the round image in the middle and gray color in the corners.

问题是如何显示表单背景而不是灰色?

The question is how can I display form background instead of gray color?

感谢您的关注

推荐答案

您可以设置按钮的某些属性以获得所需的内容:

You can set some property of your button to gain what you need:

  • 将按钮的 FlatStyle 属性更改为 Flat
  • 将其 BackColor 属性设置为 Transparent
  • FlatAppearance中设置BorderSize为0.
  • FlatAppearance中,您还可以将MouseDownBackColorMouseOverBackColor 设置为表单的背景颜色或您想要的颜色.
  • Change FlatStyle property of your button to Flat
  • Set its BackColor property to Transparent
  • In FlatAppearance Set BorderSize to 0.
  • In FlatAppearance You can also set MouseDownBackColor and MouseOverBackColor to back color of form or the color you want.

这篇关于winform中的图标按钮布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆