john tindell
Jan 11th, 2005, 01:00 PM
Is it possible to change the opacity on a Panel control. I have search but all i could find was about window forms.
Thanks
wossname
Jan 23rd, 2005, 04:27 AM
I have a quivk VB sample here... Havent got C# at home :) Shouldn't be hard to translate.
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'timer event handler
Static aa As Integer
Panel1.BackColor = Color.FromArgb(aa, 255, 0, 0)
aa += 10 'amount of opacity change for each timer tick
If aa > 255 Then Timer1.Enabled = False 'finished fade-in
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Interval = 100 '10 times a second
Timer1.Enabled = True 'go!
End Sub
That should get you started. It simply uses a timer to increase the Alpha component of the panel's backcolor. Its a bit flickery but you could always use a backbuffer to solve that problem, if you can be bothered :D