Opacity of Form in VB.Net in Visual Studio 2005

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • StrykerNet
    New Member
    • Aug 2008
    • 13

    #1

    Opacity of Form in VB.Net in Visual Studio 2005

    I'm trying to make my main forms opacity 50% on the click event of my buttons but I can not do it. Would appreciate assistance.
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    There should be a property of the form called Opacity. You can set this to a value between 0 and 1. 0 being invisible, 1 being opaque.

    So, in your button click event handler:
    Code:
    Me.Opacity = .5

    Comment

    • joedeene
      Contributor
      • Jul 2008
      • 579

      #3
      exactly as insertalias said but if you want to set the original opacity back again after the buttons events were finished do something like...

      Code:
      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
              Me.Opacity = 0.5
      
              'any code here necessary
      
              Me.Opacity = 1
      
          End Sub

      and it will make the form half transparent and when the button's events are finished returns the original opacity to the form

      Comment

      Working...