本文介绍了如何使picturebox的背景完全透明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,即使我已经将图片框的背景颜色设置为透明

但是我发现它不完全透明



i制作了两个图片框。

如果picturebox1覆盖在图片盒2上

i发现picturebox1实际上不透明

但它正在使用表单颜色的背景颜色



是否有任何方法可以使其透明?

即使picturebox1叠加在另一个图片框上,

透明部分将显示给其他图片框的图像..



我尝试过:



Dim _panel As New Panel



with _panel

.Location = New Point( 250,125)

。尺寸=新尺码(1116,593)

。背景颜色=颜色。透明

结束



.Controls.Add(_panel)



Dim _referralButton作为新的PictureBox



使用_referralButton



.SizeMode = PictureBoxSizeMode.StretchImage

.Size =新尺寸(200,200)

.BackColor = Color.Transparent

。位置=新Point((_ panel.Width - _referralButton.Width)/ 2,_

(_panel.Height - _referralButton.Height)/ 2)

.Image = Image.FromFile( C:\ Leech \ img \ Referral.png)

结束



'_panel.Controls.Add(_referralButton )



Dim _Button As New PictureBox



with _Button

.SizeMode = PictureBoxSizeMode.StretchImage

.Size =新尺寸(150,150)

.BackColor = Color.Trans父母

.Image = Image.FromFile(C:\ Leech \ img \ Button.png)

。位置=新点(_panel.Width / 4 + _Button.Width / 4,_

(_panel.Height * 3/4) - (_Button.Height * 3/4))

结束



_panel.Controls.Add(_Button)

解决方案




hello, even i already set the color of background for a picture box to transparent
but i found that, it was not complete transparent

i made two picturebox.
if picturebox1 overlay on picturebox 2
i found that the picturebox1 actually was not transparent
but it was using the backcolor of the form's color

is there any method to make it transparent?
even if the picturebox1 was overlay on the other picturebox ,
the transparent part will show to image of other picturebox..

What I have tried:

Dim _panel As New Panel

With _panel
.Location = New Point(250, 125)
.Size = New Size(1116, 593)
.BackColor = Color.Transparent
End With

.Controls.Add(_panel)

Dim _referralButton As New PictureBox

With _referralButton

.SizeMode = PictureBoxSizeMode.StretchImage
.Size = New Size(200, 200)
.BackColor = Color.Transparent
.Location = New Point((_panel.Width - _referralButton.Width) / 2, _
(_panel.Height - _referralButton.Height) / 2)
.Image = Image.FromFile("C:\Leech\img\Referral.png")
End With

' _panel.Controls.Add(_referralButton)

Dim _Button As New PictureBox

With _Button
.SizeMode = PictureBoxSizeMode.StretchImage
.Size = New Size(150, 150)
.BackColor = Color.Transparent
.Image = Image.FromFile("C:\Leech\img\Button.png")
.Location = New Point(_panel.Width / 4 + _Button.Width / 4, _
(_panel.Height * 3 / 4) - (_Button.Height * 3 / 4))
End With

_panel.Controls.Add(_Button)

解决方案




这篇关于如何使picturebox的背景完全透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 22:01