By default, controls do not support transparent backcolors. However, you can allow your control to have a background color that is opaque, transparent, or partially transparent by using the Control.SetStyle Method in the constructor.
SetStyle(ControlStyles.SupportsTransparentBackColor, True)
Me.BackColor = Color.Transparent
By default, controls do not support transparent backcolors. However, you can allow your control to have a background color that is opaque, transparent, or partially transparent by using the Control.SetStyle Method in the constructor. The SetStyle method is a method of the Control class that allows you to set particular style preferences for your controls, and can be used to enable or disable support for transparent backcolors.
To give your control a transparent backcolor
In the Code Editor for your control, locate the constructor.
Call the SetStyle method of your form in the constructor.
' Visual Basic
SetStyle(ControlStyles.SupportsTransparentBackColor, True)
// C#
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
This will enable your control to support a transparent backcolor.
Beneath the line of code you added in step 1, add the following line. This will set your control's BackColor to Transparent. :
' Visual Basic
Me.BackColor = Color.Transparent
// C#
this.BackColor = Color.Transparent;
Note that you can also create colors that are partially transparent using the Color.FromArgb method. For more information on colors, see Pens, Brushes, and Colors.
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 60