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?
Thank you for your attention
You can set some property of your button to gain what you need:
FlatStyle
property of your button to Flat
BackColor
property to Transparent
FlatAppearance
Set BorderSize
to 0. FlatAppearance
You can also set MouseDownBackColor
and MouseOverBackColor
to back color of form or the color you want. You can make you control have a transparent background and then use a transparent PNG as the icon and voila.
See this Microsoft Article with regards to creating transparent backgrounds on controls
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.