在VB.NET应用程序中,有没有一种简单的方法来创建透明表单?

在VB.NET应用程序中,有没有一种简单的方法来创建透明表单?,vb.net,transparency,Vb.net,Transparency,我正在编写一个简单的应用程序,它将在屏幕的一角有一个小表单,可以自我更新 我真的很希望表单是透明的,并且透明度可以由用户配置 有什么简单的方法可以实现这一点吗?您可以设置Form.Opacity属性。它应该可以执行您想要的操作。您可以尝试使用表单的属性。以下是MSDN页面中的相关片段: private Sub CreateMyOpaqueForm() ' Create a new form. Dim form2 As New Form() ' Set the text disp

我正在编写一个简单的应用程序,它将在屏幕的一角有一个小表单,可以自我更新

我真的很希望表单是透明的,并且透明度可以由用户配置


有什么简单的方法可以实现这一点吗?

您可以设置
Form.Opacity
属性。它应该可以执行您想要的操作。

您可以尝试使用表单的属性。以下是MSDN页面中的相关片段:

private Sub CreateMyOpaqueForm()
   ' Create a new form.
   Dim form2 As New Form()
   ' Set the text displayed in the caption.
   form2.Text = "My Form"
   ' Set the opacity to 75%.
   form2.Opacity = 0.75
   ' Size the form to be 300 pixels in height and width.
   form2.Size = New Size(300, 300)
   ' Display the form in the center of the screen.
   form2.StartPosition = FormStartPosition.CenterScreen

   ' Display the form as a modal dialog box.
   form2.ShowDialog()
End Sub

在页面加载时设置
Form.Opacity=0.0


我设置了一些类似于一年前你在应用程序上谈论的内容。使用
While
循环和一个小的
Sleep
可以设置一个很好的淡入效果。

我不知道透明是什么意思,但是如果使用WPF,可以在窗体上设置
AllowTransparency=True
,然后删除窗体的样式/边框,然后将背景设置为具有零alpha通道的颜色。然后,你可以在表格上画你想要的一切,背景将被看穿,其他东西将完全可见。此外,您可以将背景设置为低不透明度层,这样您就可以看到窗体的一半