How do you set or adjust opacity of controls during runtime? (buttons/textbox/etc)

I've tried this

Public Sub setOpacity(ByVal opacity As Integer)
        Me.BackColor = Color.FromArgb(opacity, 255, 255, 255)
    End Sub

But error returns that it controls does not support opacity.

I want my controls to load on runtime with fade-in effects.

Any links to any tutorial?

Recommended Answers

All 3 Replies

yoro,

Have a look at an article at code project.

I dunno if this helps but i tried this to fade on a form.....

Public Sub mainload()
        Dim sngOpacity As Single
        Mainform.Refresh()
        For sngOpacity = 0 To 1 Step 0.04
            Mainform.Opacity = sngOpacity
            ' Let the form repaint itself.
            Mainform.Refresh()
            ' Create a delay.
            System.Threading.Thread.Sleep(10)
        Next
        Mainform.Opacity = 100%
    End Sub

I dunno if this helps but i tried this to fade on a form.....

Public Sub mainload()
        Dim sngOpacity As Single
        Mainform.Refresh()
        For sngOpacity = 0 To 1 Step 0.04
            Mainform.Opacity = sngOpacity
            ' Let the form repaint itself.
            Mainform.Refresh()
            ' Create a delay.
            System.Threading.Thread.Sleep(10)
        Next
        Mainform.Opacity = 100%
    End Sub

Thats the opacity of the form, controls have no .opacity

yoro,

Have a look at an article at code project.

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.