我正在使用 Visual Basic 中的第一个应用程序,我正在使用 Visual Basic Studio...我创建了一个带有按钮的表单 - 表单有一个带圆角的背景图像,我无法将其颜色设置为“透明”,因为发生以下错误:
Control does not support transparent background colors.
现在我不知道该怎么办。我已经读到我可以通过添加以下行来设置代码的透明度:
SetStyle(ControlStyles.SupportsTransparentBackColor, True)
Me.BackColor = Color.Transparent
但它似乎不起作用......那我还能做什么?
整个代码:
Public Class Form1
Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
MsgBox("Test", 32, "Button Click")
End Sub
Private Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
Close()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
SetStyle(ControlStyles.SupportsTransparentBackColor, True)
Me.BackColor = Color.Transparent
End Sub
End Class