0

I would like to put many transparent button on picture box.
I am able to do this programically but all button are with solid background color.
Is it possible to make button components with transparent background and display them over picture box?
I want to do this using button because I have to have events belong to buttons.

I saw this post Transparent control over PictureBox but I cannot make it work with buttons.

Community
  • 1
  • 1
Przemo
  • 193
  • 2
  • 16

2 Answers2

0

Solution

button over picturebox doesn't support the border color on Color.Transparent, you can overcome the issue by setting an Argb color:

Color.FromArgb(0, 255, 255, 255); // transparent

Add below properties to a button over picturebox to do this

btn.TabStop = false;
btn.FlatStyle = FlatStyle.Flat;
btn.FlatAppearance.BorderSize = 0;
btn.FlatAppearance.MouseDownBackColor = Color.FromArgb(0, 255, 255, 255);
btn.FlatAppearance.MouseOverBackColor = Color.FromArgb(0, 255, 255, 255);
btn.FlatAppearance.BorderColor = Color.FromArgb(0, 255, 255, 255);
btn.BackColor = Color.FromArgb(0, 255, 255, 255);
Seyon Seyon
  • 527
  • 4
  • 14
-1

I found solution for this.

btn.FlatStyle = Windows.Forms.FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.FlatAppearance.MouseDownBackColor = Color.Transparent
btn.FlatAppearance.MouseOverBackColor = Color.Transparent
btn.BackColor = Color.Transparent
Przemo
  • 193
  • 2
  • 16