Reputation: 513
I am doing project in vb.net When i click on button open I opened form with no control box(minimize,maximize etc).set borderStyle to FixedToolWindow I want to change the opacity of form on got focus & lost focus event. I also used activated & deactivated event but doesnt working
Private Sub form_Deactivate(ByVal sender As Object, ByVal e As System.EventArgs)HandlesMyBase.Deactivate
Me.Opacity =0
End Sub
Private Sub form_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated
Me.Opacity = 1
End Sub
Upvotes: 1
Views: 1635
Reputation: 1003
Try 0.01 in your 2nd line. You used 0 and it will hide your form.
Because that when you click in form area , the form_Actived don't run.
Upvotes: 1
Reputation: 21561
To do this you need to use a System.Windows.Forms.Timer. the implementation is very simple:
For a full example of how to do this, see this article.
Best regards,
Upvotes: 1