hello, i am wanting to be able to change the form's opacity up and down whenever the mouse wheel is scrolled, but only to a point. how can i do this? ^^
Printable View
hello, i am wanting to be able to change the form's opacity up and down whenever the mouse wheel is scrolled, but only to a point. how can i do this? ^^
For mouse wheel events see this
for opacity, declare these API's
vb Code:
Option Explicit Private Declare Function GetWindowLongA Lib "user32" _ (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLongA Lib "user32" _ (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function SetLayeredWindowAttributes Lib "user32" _ (ByVal hwnd As Long, ByVal crey As Byte, ByVal bAlpha As Byte, _ ByVal dwFlags As Long) As Long Private Const GWL_EXSTYLE = (-20) Private Const WS_EX_LAYERED = &H80000 Private Const LWA_ALPHA = &H2& Private Function Opacity(Value As Byte, Frm As Form) On Error GoTo ErrorHandler Dim MaxVal As Byte, MinVal As Byte '20 is the lowest opacity setting and 255 is the highest MinVal = 20: MaxVal = 255 If Value > MaxVal Then Value = MaxVal If Value < MinVal Then Value = MinVal SetWindowLongA Frm.hwnd, GWL_EXSTYLE, GetWindowLongA(Frm.hwnd, GWL_EXSTYLE) _ Or WS_EX_LAYERED SetLayeredWindowAttributes Frm.hwnd, 0, Value, LWA_ALPHA ErrorHandler: Exit Function End Function Public Sub MouseWheelRolled() 'to use this event see 'http://www.andreavb.com/tip060008.html as mentioned in the 1st line above 'This will change the form "me"'s opacity to 150. Opacity 150, Me End Sub
Sorry to barge in on this but how would you use mouse wheel with Browser control, or FireFox Browser control.