我努力讓我的形式有新我設置如何設置窗體有一個透明的背景
Me.SetStyle(ControlStyles.SupportsTransparentBackColor, true)
但還是形式在vb.net透明背景
目前該表格顯示爲具有默認灰色背景
任何人都可以幫忙嗎?
編輯:我需要的控件在窗體上是可見的,所以我不覺得不透明度設置爲0,將工作
編輯:我試過的透明度關鍵解決方案,但它不工作。我有一個黑色背景的圓形圖像。 OnPaint我將透明度鍵設置爲0,0的img像素,然後給我留下圓形圖像(我想要)它隱藏了黑色背景,但我仍然留下了窗體的默認灰色矩形。
下面是我的代碼 -
Public Sub New()
Me.SetStyle(ControlStyles.SupportsTransparentBackColor, True)
Me.BackColor = Color.Transparent
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Me.Timer1.Start()
End Sub
Private Sub frmWoll_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim img As Bitmap = CType(Me.BackgroundImage, Bitmap)
img.MakeTransparent(img.GetPixel(2, 2))
Me.TransparencyKey = img.GetPixel(2, 2)
End Sub
我添加了下面的代碼以獲取您正在查找的確切內容。 如果需要額外的東西,請發表評論,我會更新相同的 – 2009-02-09 13:32:51