Results 1 to 6 of 6

Thread: Fade a Panel [RESOLVED]

  1. #1
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 02
    Location
    Brighton, UK
    Posts
    1,099

    Resolved Fade a Panel [RESOLVED]

    Is it possible to change the opacity on a Panel control. I have search but all i could find was about window forms.

    Thanks
    Last edited by john tindell; Jan 28th, 2005 at 09:31 AM.

  2. #2
    Noodly Appendage wossname's Avatar
    Join Date
    Aug 02
    Location
    #!/bin/bash
    Posts
    5,645

    Re: Fade a Panel

    I have a quivk VB sample here... Havent got C# at home Shouldn't be hard to translate.

    VB Code:
    1. Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    2. 'timer event handler
    3.         Static aa As Integer
    4.  
    5.         Panel1.BackColor = Color.FromArgb(aa, 255, 0, 0)
    6.         aa += 10 'amount of opacity change for each timer tick
    7.  
    8.         If aa > 255 Then Timer1.Enabled = False 'finished fade-in
    9.  
    10.     End Sub
    11.  
    12.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    13.  
    14.         Timer1.Interval = 100 '10 times a second
    15.         Timer1.Enabled = True 'go!
    16.  
    17.     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
    Last edited by wossname; Jan 23rd, 2005 at 04:38 AM.
    I don't live here any more.

  3. #3
    Addicted Member
    Join Date
    Jun 12
    Posts
    152

    Re: Fade a Panel

    Is it possible to do it somehow to work on a Transparent Panel? I want all the contents of the panel to fade away, not the panel itself

  4. #4
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 05
    Location
    Lansing, MI; USA
    Posts
    3,786

    Re: Fade a Panel

    Quote Originally Posted by vasil7112 View Post
    Is it possible to do it somehow to work on a Transparent Panel? I want all the contents of the panel to fade away, not the panel itself
    Put a panel inside the panel would probably be the easiest way to do that.
    Currently using: VS 2010 Ultimate on Win7 Ultimate x64.



    CodeBank: All Threads • Colors ComboBox • Fading & Gradient Form • MoveItemListBox/MoveItemListView • MultilineListBox • MenuButton • ToolStripCheckBox • Start with Windows

  5. #5
    Addicted Member
    Join Date
    Jun 12
    Posts
    152

    Re: Fade a Panel

    Quote Originally Posted by JuggaloBrotha View Post
    Put a panel inside the panel would probably be the easiest way to do that.
    Well here is my stracture
    A panel with transparent BG that shows the BG of the template
    Some buttons in the panel
    And what i want now, is a code the will make all the buttons fade away, but only by typing a small code like fade a panel

  6. #6
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 05
    Location
    Lansing, MI; USA
    Posts
    3,786

    Re: Fade a Panel [RESOLVED]

    So put those buttons on a panel that's on the other panel, that way you can fade the buttons only panel like you want.
    Currently using: VS 2010 Ultimate on Win7 Ultimate x64.



    CodeBank: All Threads • Colors ComboBox • Fading & Gradient Form • MoveItemListBox/MoveItemListView • MultilineListBox • MenuButton • ToolStripCheckBox • Start with Windows

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •