Transparent Form...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ali Rizwan
    Banned
    Contributor
    • Aug 2007
    • 931

    Transparent Form...

    Hi all,
    I know how to make a form transparent and how to create fadein and out effects on forms and controls both. But i dont know how can i make a form transparent but the controls are not transparent they must be visible. Or you can say i want to make my form transparent but i dont want to make controls on the form transparent.

    Thanx
    >> ALI <<
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    #2
    Originally posted by Ali Rizwan
    Hi all,
    I know how to make a form transparent and how to create fadein and out effects on forms and controls both. But i dont know how can i make a form transparent but the controls are not transparent they must be visible. Or you can say i want to make my form transparent but i dont want to make controls on the form transparent.

    Thanx
    >> ALI <<
    What type of controls are you referring to, Ali? And why do they need to remain transparent. Perhaps there is another way to achieve if you could cpould post the working code.

    In a bit!

    Dököll

    Comment

    • Ali Rizwan
      Banned
      Contributor
      • Aug 2007
      • 931

      #3
      Originally posted by Dököll
      What type of controls are you referring to, Ali? And why do they need to remain transparent. Perhaps there is another way to achieve if you could cpould post the working code.

      In a bit!

      Dököll
      The code is large. You can check my code in How to section. I have posted my codes to fade or making transparent form and controls.
      But i dont want it that way. When i use that code form make transparent itself and all the controls on it. but i dont want to make controls trasparent.

      Thanx
      >> ALI <<

      Comment

      • daniel aristidou
        Contributor
        • Aug 2007
        • 494

        #4
        Hey ali.
        In newer versions of vb.
        Set the background colour to a colour unused in the rest of your controls.
        Then under the forms properties set the "Transparen cy colour/key" equal to that of your form.

        i think you are using vb6.....which means...complic ations....and therfore this probably is not an option

        Comment

        • jamesd0142
          Contributor
          • Sep 2007
          • 471

          #5
          Originally posted by daniel aristidou
          Hey ali.
          In newer versions of vb.
          Set the background colour to a colour unused in the rest of your controls.
          Then under the forms properties set the "Transparen cy colour/key" equal to that of your form.

          i think you are using vb6.....which means...complic ations....and therfore this probably is not an option

          Wow i tested this in vb2005, its neat!

          James

          Comment

          • Ali Rizwan
            Banned
            Contributor
            • Aug 2007
            • 931

            #6
            James and deniel i know and i have done this a long time ago in vb2008 by setting form's transperent color. I got an idea about doing it in vb6.

            I ll upload a file but the way i m trying to do is a bit different, But stiil there is a problem i want to make the form semitransperent not completely transperent. and i knw this cannot be done in vb2008 too.

            Thanx
            >> ALI <<

            Comment

            • daniel aristidou
              Contributor
              • Aug 2007
              • 494

              #7
              Originally posted by Ali Rizwan
              i want to make the form semitransperent not completely transperent. and i knw this cannot be done in vb2008 too.

              Thanx
              >> ALI <<
              Ali i think it can be done in vb08:
              using silverlight.
              insert a WPF user control..and this allows you to set a transparency% and amazing graphics....and shadows...etc.
              Or you could convert your application:
              instead of windows application
              select Presentation application.

              Comment

              • shuvo2k6
                New Member
                • Jan 2008
                • 68

                #8
                Originally posted by daniel aristidou
                Ali i think it can be done in vb08:
                using silverlight.
                insert a WPF user control..and this allows you to set a transparency% and amazing graphics....and shadows...etc.
                Or you could convert your application:
                instead of windows application
                select Presentation application.

                Try by this:
                Code:
                Private Const GWL_EXSTYLE As Long = -20
                Private Const WS_EX_LAYERED As Long = &H80000  
                Private Const LWA_ALPHA As Long = &H2  
                Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long  Private Declare Function SetLayeredWindowAttributes Lib "user32.dll" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long  
                Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long  
                Private Declare Function SetParent Lib "user32.dll" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long  
                Dim alpha As Integer  
                Const MAXALPHA As Integer = 250  
                Const MINALPHA As Integer = 0  
                Private Sub SetTrans(ByVal OB_Hwnd As Long, ByVal OB_Val As Integer)  On Error Resume Next     
                Dim Attrib As Long     
                Attrib = GetWindowLong(OB_Hwnd, GWL_EXSTYLE)     
                SetWindowLong OB_Hwnd, GWL_EXSTYLE, Attrib Or WS_EX_LAYERED     SetLayeredWindowAttributes OB_Hwnd, RGB(0, 0, 0), OB_Val, LWA_ALPHA     
                FTransVal = OB_Val     
                Exit Sub 
                End Sub  
                Private Sub Command1_Click()  
                If MAXALPHA = alpha Then  
                Exit Sub  
                End If  
                SetTrans Me.hwnd, alpha  
                alpha = alpha + 10  
                End Sub  Private 
                Sub Command2_Click()  
                If MINALPHA = alpha Then  
                Exit Sub 
                End If  
                SetTrans Me.hwnd, alpha  
                alpha = alpha - 10  
                End Sub  
                Private Sub Form_Load()  
                alpha = MAXALPHA  
                End Sub

                Comment

                • Ali Rizwan
                  Banned
                  Contributor
                  • Aug 2007
                  • 931

                  #9
                  Are you sure this will set transperency to form only not to controls.

                  Thanx
                  >> ALI <<

                  Comment

                  Working...