注释:form上有Command1,command2两个Button并事先设定form之BorderStyle=0
OptionExplicit
PrivateDeclareFunctionGetWindowLongLib”user32″Alias”GetWindowLongA”(ByValhwndAsLong,ByValnIndexAsLong)AsLong
PrivateDeclareFunctionSetWindowLongLib”user32″Alias”SetWindowLongA”(ByValhwndAsLong,ByValnIndexAsLong,ByValdwNewLongAsLong)AsLong
ConstGWL_EXSTYLE=(-20)
ConstWS_EX_TRANSPARENT=&H20&
PrivatePreValueAsLong
PrivateSubCommand2_Click()注释:还原变成不透明
CallSetWindowLong(Me.hwnd,GWL_EXSTYLE,PreValue)
Me.Hide
Me.Show
EndSub
PrivateSubForm_Load()
DimiAsLong
i=GetWindowLong(Me.hwnd,GWL_EXSTYLE)
注释:变成透明的Form
PreValue=SetWindowLong(Me.hwnd,GWL_EXSTYLE,iOrWS_EX_TRANSPARENT)
Me.Show
DoEvents
Command1.Refresh注释:令Command1可见
Command2.Refresh注释:令Command2可见
EndSub->