I have been part time working on the same application for a year. its a very self serving, on day freeware application for easily accessing applications ect.

I need a container for dynamically create rows of buttons, I am currently using some transparent panels, and changing their visibility when I need to change a "page". when a "page" is full I create a new panel, add it to an object arraylist of panels and have the arrow keys change between the visible panel by looping through all the panels and hiding them, them showing the one that should be shown.

I had an idea that I could just use the tabcontrol and hide its tabs. but I am unsure how well that will work. or maybe there is a much better way to go about this? does the tabcontrol accept a transparent background well?

should I create my own custom user control to act as a panel? seems like a userdrawn control that inherits from UserControl with a transparent background would do this...

I am looking for the best performance, least amount of flicker, and most efficient usage of resources. what was suppose to be a very fast application after EXTENSIVE use of fancy custom drawn everything it seems I am loosing much of that speed.

You will probably want to create a user control then. If you add too many individual controls to a form you kill the performance. But in the case of a user control you would be adding a single container control, which has multiple child controls. Windows can manage this more efficiently.

Here is a tab control that allows you to hide tabs:

using System;
using System.ComponentModel;
using System.Windows.Forms;

namespace daniweb
  public class TabControlEx : TabControl
    /// <summary>
    /// Gets or sets a value indicating whether the tab headers should be drawn
    /// </summary>
    Description("Gets or sets a value indicating whether the tab headers should be drawn"),
    public bool ShowTabHeaders { get; set; }

    public TabControlEx()
      : base()

    protected override void WndProc(ref Message m)
      //Hide tabs by trapping the TCM_ADJUSTRECT message
      if (!ShowTabHeaders && m.Msg == 0x1328 && !DesignMode) 
        m.Result = (IntPtr)1;
        base.WndProc(ref m);

Drop a normal tab control on to a form then open up the form's design file and locate these two lines:

this.tabControl1 = new <ProjectName>.TabControl();
//further down you will find this:
private TabControl tabControl1;

Change them to:

this.tabControl1 = new <ProjectName>.TabControlEx();
private TabControlEx tabControl1;

Switch back to your designer and select the tab control and change the "ShowTabHeaders" value to false.

I didn't know that windows handles controls in containers better than just on the form. Thanks for that knowledge Scott. And thanks for the code snippet, elegant as always.