为何无法透明啊?
如题,为什么啊button不是透明的?
public Form1()
{
InitializeComponent();
UseTransparentProperty();
}
private void UseTransparentProperty()
{
// Set up the PictureBox to display the entire image, and
// to cover the entire client area.
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBox1.Dock = DockStyle.Fill;
try
{
// Set the Image property of the PictureBox to an image retrieved
// from the file system.
pictureBox1.Image =
Image.FromFile("C:\\Documents and Settings\\All Users\\" +
"Documents\\My Pictures\\示例图片\\sunset.jpg");
// Set the Parent property of Button1 and Button2 to the
// PictureBox.
button1.Parent = pictureBox1;
button2.Parent = pictureBox1;
// Set the Color property of both buttons to transparent.
// With this setting the buttons assume the color of their
// parent.
button1.BackColor = Color.Transparent;
button2.BackColor = Color.Transparent;
}
catch (
System.IO.Fil