I have a simple question, if I have a button called myButton in Windows Forms, what is the difference of myButton.Image and myButton.BackgroundImage? Thank you in advance!
BackgroundImage
is like wallpaper, it covers the whole background.. you should use patterns or full pictures for the background. If you are just trying to show an icon use Button.Image
For the Button.Image
property from MS documentation:
The Image displayed on the button control.
The BackgroundImage
An Image that represents the image to display in the background of the control.
So you can set a BackgoundImage
as well as a Button.Image
the Button.Image
will be placed over top of the BackgroundImage
Note: Images with translucent or transparent colors are not supported by Windows Forms controls as background images. This property is not supported on child controls whose RightToLeftLayout property is true.
Here is an example I just created of a Button
with both BackgroundImage
and Button.Image
set. Clearly there is a background image, then my button text and a button image next to my text.
The cool thing is you can change where you place your Button.Image
with the ImageAlign
property
Here's the same button using an icon with transparency and NOT using RTL and I set the background color to light blue and it all works fine. So either my icon with transparency really isn't transparent or the docs are wrong.
Background Image - The image as in the name suggests, gets set in the background and the text comes over it.
Image - The Image is adjacent(side-by side) to Text provided. (See in Image)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With