透明的窗体(From)上显示背景透通图
下面是个透明的窗体(From)上显示背景透通图教程,撑握了其技术要点,学起来就简单多了。赶紧跟着图老师小编一起来看看吧!
首先我使用以下的程式码令Form变透明
注:有适当的软体(如MSPhotEditor)可以将图变成背景透通(引用老怪之言)
Me.AutoRedraw=True
hBitmap=CreateCompatibleBitmap(Me.hdc,0,0)
SelectObjectMe.hdc,hBitmap
Me.Refresh
而透明的图形呢,那需要那一种背景透通性的.GIF档,在Form上放一个ImageControl,将
图放到ImageControl,那就OK了注释:需一个ImageControl,一个Command1
OptionExplicit
PrivateDeclareFunctionSelectObjectLib"gdi32"(ByValhdcAsLong,ByValhObjectAsLong)AsLong
PrivateDeclareFunctionDeleteObjectLib"gdi32"(ByValhObjectAsLong)AsLong
PrivateDeclareFunctionCreateCompatibleBitmapLib"gdi32"(ByValhdcAsLong,ByValnWidthAsLong,ByValnHeightAsLong)AsLong
PrivatehBitmapAsLong
PrivateSubCommand1_Click()
UnloadMe
EndSub
PrivateSubForm_Load()
注释:事先请设form的BorderStyle=0没有框线
Me.AutoRedraw=True
SetImage1.Picture=LoadPicture("e:ubbles.gif")注释:请自行找一个背景透明的图
hBitmap=CreateCompatibleBitmap(Me.hdc,0,0)
SelectObjectMe.hdc,hBitmap
Me.Refresh
EndSub
PrivateSubForm_Unload(CancelAsInteger)
DeleteObjecthBitmap
EndSub->