求解,控件的不透明度怎么设置?
vb2010吧
全部回复
仅看楼主
level 5
SHDSHCH 楼主
原计划是想设计一个包含控件的窗体,透明度为60%,当鼠标移到窗体时透明度变为1,离开时再变成60%,但当鼠标移动到控件(比如按钮)上时,Form1的透明度就变成60%,怎样才能做到即使鼠标在控件上,Form1的透明度也保持60%不变?
这是代码:
Private Sub Form1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseLeave
Me.Opacity = 1
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
Me.Opacity = 0.6
End Sub
2012年04月02日 09点04分 1
level 9
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Me.Opacity = 0.6
For Each s As Control In Me.Controls
AddHandler s.MouseMove, AddressOf Form1_MouseMove
Next
End Sub
Private Sub Form1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseLeave
Me.Opacity = 0.6
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
Me.Opacity = 1
End Sub

2012年04月02日 10点04分 2
level 5
SHDSHCH 楼主
高手!万分感谢。
[大拇指][大拇指][大拇指][大拇指]

2012年04月02日 11点04分 3
level 1
2013年07月16日 00点07分 4
level 10
高手指教,加精必然~~
2013年07月16日 02点07分 5
1