Search code examples
c#.netwinformspanel

Flickering with transparent panel


I've created a simple program and now i'm in the stages of doing my designing. I've got a multiple Panels which i make visible / invisible to switch between "tabs" (EG. 1 panel for the login screen and 1 panel for the create account screen). Now i've made these panels invisible because i want them just as containers to be able to quickly move around controls and create buttons in.

My problem is that i've set my forms background image to a image i made in photoshop and whenever i switch between panels it flickers, whenever i just use a system color (white,black) this doesn't happen. Is there any way for me to remove the flickering?

i've tried :

  • Setting double buffer to true
  • protected overrideing OnPaint, CreateBackground, and Createparam

my code is extremely basic :

private void btnNewAcc_Click(object sender, EventArgs e)
    {
        PanelNewAccount.Visible = true;
        PanelLogin.Visible = false;
    }

Solution

  • Thanks to Patrick i've solved my problem, instead of using panels i'm using a TabControl and i assigned the same background to each tab. Just as easy to add dynamic buttons as well. Same features as panels but without the flickering.