954,517 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Setting/Adjusting Opacity of Controls

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?

yorro
Junior Poster
121 posts since Aug 2009
Reputation Points: 8
Solved Threads: 7
 

yoro,

Have a look at an article at code project.

__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

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
Arunabh Nag
Light Poster
40 posts since Apr 2009
Reputation Points: 10
Solved Threads: 1
 

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

yorro
Junior Poster
121 posts since Aug 2009
Reputation Points: 8
Solved Threads: 7
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: