vb能否制作透明的form?(50分)

X

xwfu

Unregistered / Unconfirmed
GUEST, unregistred user!
在MDIFORM上的子form显示了一幅地图,想再显示另一form,但又不遮挡地图,
不知怎么实现?
 
W

www

Unregistered / Unconfirmed
GUEST, unregistred user!
能.
可以用SetWindowLong(hwnd, GWL_EXSTYLE, WS_EX_TRANSPARENT)来完成
'form上有Command1, command2两个Button并事先设定form之BorderStyle = 0
Option Explicit
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Const GWL_EXSTYLE = (-20)
Const WS_EX_TRANSPARENT = &H20&
Private PreValue As Long
Private Sub Command2_Click() '还原变成不透明
Call SetWindowLong(Me.hwnd, GWL_EXSTYLE, PreValue)
Me.Hide
Me.Show
End Sub
Private Sub Form_Load()
Dim i As Long
i = GetWindowLong(Me.hwnd, GWL_EXSTYLE)
'变成透明的Form
PreValue = SetWindowLong(Me.hwnd, GWL_EXSTYLE, i Or WS_EX_TRANSPARENT)
Me.Show
DoEvents
Command1.Refresh '令Command1可见
Command2.Refresh '令Command2可见
End Sub
别忘了给我加分啊!!
 
A

Another_eYes

Unregistered / Unconfirmed
GUEST, unregistred user!
试过吗? 我觉得你的代码无法实现.
 
X

xwfu

Unregistered / Unconfirmed
GUEST, unregistred user!
to www:
试了一下,基本上行.
将form_load中的代码去掉后(放到command1中),运行时form有时全部为不可见.
to Another_eYes:
上次你贴的读卡机的程序,看过后,深受启发,就是想将读出的内容发到writestring
函数中去,作为writestring的返回值,返给调用writestring的外部程序,一直也没
能够实现.现在有人将此问题贴出在"系统相关"栏目,赶紧去拿分吧.
 

Similar threads

D
回复
0
查看
724
DelphiTeacher的专栏
D
I
回复
0
查看
688
import
I
顶部