Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net vb中的图片框透明度_Vb.net_Transparency_Picturebox - Fatal编程技术网

Vb.net vb中的图片框透明度

Vb.net vb中的图片框透明度,vb.net,transparency,picturebox,Vb.net,Transparency,Picturebox,当我运行代码时,图片框有一个背景色,即使我在属性窗口中将背景色设置为透明。有什么想法吗?我想你把一个图片盒重叠在其他控件上,希望看穿图片盒。这不是它的工作原理-具有透明背景的控件仅相对于其父控件是透明的,而不是其他控件。您可以通过覆盖表单的OnPaint方法,使用GDI+绘制它们: Private Shared ReadOnly SomeImage As Image = My.Resources.blah 'Get your image somewhere Protected Override

当我运行代码时,图片框有一个背景色,即使我在属性窗口中将背景色设置为透明。有什么想法吗?

我想你把一个
图片盒
重叠在其他控件上,希望看穿
图片盒
。这不是它的工作原理-具有透明背景的控件仅相对于其父控件是透明的,而不是其他控件。您可以通过覆盖表单的
OnPaint
方法,使用GDI+绘制它们:

Private Shared ReadOnly SomeImage As Image = My.Resources.blah 'Get your image somewhere

Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
    Dim g As Graphics = e.Graphics

    g.DrawImage(SomeImage, xCoordinate, yCoordinate)

    'Draw as many images or text as you want.
End Sub

此外,人们似乎大多在寻找这种功能来制作游戏。你在做游戏吗?如果是这种情况,请在制作游戏之前学习图形。有很多很好的教程。

谢谢。我不是在做游戏,我在尝试为AS3练习一个*路径查找,但是在VB中更舒服。虽然现在我有一个新问题——我画的线没有显示在窗体上的控件上。是在他们面前画的吗?山姆:是的。要做到这一点,您需要使用GDI绘制它们。但别担心,这很好,因为你不需要照片。(参见
图形.抽绳
!)太棒了,谢谢-我不知道你能做到!我过去做过很多XNA,所以这应该能解决问题。谢谢你的快速回复。但还有别的办法吗?我想创建一个透明的picturebox作为“层”。