显示透明GIF [英] Displaying Transparent GIF's

查看:90
本文介绍了显示透明GIF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将VB6项目导入Express 2008后,我有两个带有

透明度的gif'无法正确显示。


在VB6中这些图片在哪里与图像对象一起使用时,不幸的是,在图片框中,只有好像只有

才能成为Express 2008工具箱中的图片框选项?


任何想法/帮助请:o)

After importing a VB6 project into Express 2008 I have two gif''s with
transparency do not display correctly.

In VB6 these pictures where used with the image object which had
different properties to the picturebox unfortunately there only seems
to be the picturebox option in the toolbox of Express 2008?

any ideas/help PLEASE :o)

推荐答案

将.BackColor设置为Transparent。


它位于Web的顶部。单击BackColor下拉按钮时的选项卡。


-

David Streeter

Synchrotech软件

澳大利亚悉尼

" Marge"写道:
Set the .BackColor to "Transparent".

It''s at the top of the "Web" tab when you click the BackColor dropdown button.

--
David Streeter
Synchrotech Software
Sydney Australia
"Marge" wrote:

将VB6项目导入Express 2008后,我有两个带有

透明度的gif'无法正确显示。 />

在VB6中,这些图片与图像对象一起使用,其中包含了与图片框不同的属性,但遗憾的是只有这样的图片才会显示

任何想法/帮助的图片框选项?


任何想法/帮助请:o)
After importing a VB6 project into Express 2008 I have two gif''s with
transparency do not display correctly.

In VB6 these pictures where used with the image object which had
different properties to the picturebox unfortunately there only seems
to be the picturebox option in the toolbox of Express 2008?

any ideas/help PLEASE :o)


嗯。这实际上并没有起作用。


谷歌出现了这个: http://www.bobpowell.net/transcontrols.htm


查找ControlStyles Enumeration在VB.NET帮助索引中也是如此。


看上去并不简单:-(


-

David Streeter

Synchrotech软件

悉尼澳大利亚

" SurturZ"写道:
Hmm. That doesn''t actually work.

Google turns up this: http://www.bobpowell.net/transcontrols.htm

Look up "ControlStyles Enumeration" in the VB.NET help index, too.

Doesn''t look simple :-(

--
David Streeter
Synchrotech Software
Sydney Australia
"SurturZ" wrote:

将.BackColor设置为Transparent。


当您单击BackColor下拉按钮时,它位于Web选项卡的顶部。 br />

-

David Streeter

Synchrotech软件

悉尼澳大利亚


" Marge"写道:
Set the .BackColor to "Transparent".

It''s at the top of the "Web" tab when you click the BackColor dropdown button.

--
David Streeter
Synchrotech Software
Sydney Australia
"Marge" wrote:

将VB6项目导入Express 2008后我有两个带有
$ b $的GIF b透明度无法正确显示。


在VB6中,这些图片与图像对象一起使用,其中包含了与图片框不同的属性,但不幸的是只有/>
是Express 2008工具箱中的图片框选项吗?

任何想法/帮助请:o)
After importing a VB6 project into Express 2008 I have two gif''s with
transparency do not display correctly.

In VB6 these pictures where used with the image object which had
different properties to the picturebox unfortunately there only seems
to be the picturebox option in the toolbox of Express 2008?

any ideas/help PLEASE :o)


呃。好吧,我让它工作,sorta。添加一个新类:


公共类PanelTransparent

继承面板


受保护的覆盖ReadOnly属性CreateParams()As

System.Windows.Forms.CreateParams

获取

Dim cp As CreateParams = MyBase.CreateParams

cp。 ExStyle =& H20''WS_EX_TRANSPARENT

返回cp

结束获取

结束物业


受保护的子InvalidateEx()

如果父母什么都没有然后退出子

Dim rc作为新矩形(Me.Location,Me.Size)

Parent.Invalidate(rc,True)

End Sub


受保护的覆盖Sub OnPaintBackground(ByVal e As

System.Windows。 Forms.PaintEventArgs)

''不允许背景被绘制

结束子


私人模仿作为图像

受保护覆盖​​Sub OnPaint(ByVal e As

System.Windows.Forms.PaintEventArgs)

e.Graphics.DrawImage(mimg,0,0)

End Sub

Public Sub New(ByVal img As Image)

mimg = img

End Sub

结束类


然后,您需要在运行时添加新控件的实例:


Private Sub Form1_Load(ByVal sender As System。对象,ByVal e As

System.EventArgs)处理MyBase.Load


Dim img As Image =

Bitmap.FromFile( My.Computer.FileSystem.SpecialDire ctories.Desktop&

" \ pitransgif.gif")

Dim pnlTransparent As New PanelTransparent(img)

Me.Controls.Add(pnlTransparent)

pnlTransparent.BringToFront()


结束子


-

David Streeter

Synchrotech软件

悉尼澳大利亚

" SurturZ"写道:
Ugh. Well I got it working, sorta. Add a new class:

Public Class PanelTransparent
Inherits Panel

Protected Overrides ReadOnly Property CreateParams() As
System.Windows.Forms.CreateParams
Get
Dim cp As CreateParams = MyBase.CreateParams
cp.ExStyle = &H20 ''WS_EX_TRANSPARENT
Return cp
End Get
End Property

Protected Sub InvalidateEx()
If Parent Is Nothing Then Exit Sub
Dim rc As New Rectangle(Me.Location, Me.Size)
Parent.Invalidate(rc, True)
End Sub

Protected Overrides Sub OnPaintBackground(ByVal e As
System.Windows.Forms.PaintEventArgs)
''do not allow the background to be painted
End Sub

Private mimg As Image
Protected Overrides Sub OnPaint(ByVal e As
System.Windows.Forms.PaintEventArgs)
e.Graphics.DrawImage(mimg, 0, 0)
End Sub
Public Sub New(ByVal img As Image)
mimg = img
End Sub
End Class

You then need to add an instance of the new control at runtime:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim img As Image =
Bitmap.FromFile(My.Computer.FileSystem.SpecialDire ctories.Desktop &
"\pitransgif.gif")
Dim pnlTransparent As New PanelTransparent(img)
Me.Controls.Add(pnlTransparent)
pnlTransparent.BringToFront()

End Sub

--
David Streeter
Synchrotech Software
Sydney Australia
"SurturZ" wrote:

嗯。这实际上并没有起作用。


谷歌出现了这个: http://www.bobpowell.net/transcontrols.htm


查找ControlStyles Enumeration在VB.NET帮助索引中也是如此。


看上去并不简单:-(


-

David Streeter

Synchrotech软件

悉尼澳大利亚


" SurturZ"写道:
Hmm. That doesn''t actually work.

Google turns up this: http://www.bobpowell.net/transcontrols.htm

Look up "ControlStyles Enumeration" in the VB.NET help index, too.

Doesn''t look simple :-(

--
David Streeter
Synchrotech Software
Sydney Australia
"SurturZ" wrote:

将.BackColor设置为Transparent。


当您单击BackColor时,它位于Web选项卡的顶部下拉按钮。


-

David Streeter

Synchrotech软件

悉尼澳大利亚
" Marge"写道:
Set the .BackColor to "Transparent".

It''s at the top of the "Web" tab when you click the BackColor dropdown button.

--
David Streeter
Synchrotech Software
Sydney Australia
"Marge" wrote:

将VB6项目导入Express 2008后,我有两个带有
$ b $的gif' b透明度无法正确显示。

>

在VB6中这些图片与图像对象一起使用,它们具有与图片框不同的属性不幸的是,在Expre的工具箱中只有

才能成为图片框选项ss 2008?

>

任何想法/帮助请:o)

>
After importing a VB6 project into Express 2008 I have two gif''s with
transparency do not display correctly.
>
In VB6 these pictures where used with the image object which had
different properties to the picturebox unfortunately there only seems
to be the picturebox option in the toolbox of Express 2008?
>
any ideas/help PLEASE :o)
>


这篇关于显示透明GIF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆