I have many user control when i click on my menus button it shows that user control i want but i was looking on GDI objects on the task manager i found that when i go to another user control the GDI not released and not dispose it is my code for adding user control to panel and dispose any user control on that panel before adding new user control:
void showControl(Control control)
{
for (int ix = tlp4.Controls.Count - 1; ix >= 0; --ix)
{
var ctl = tlp4.Controls[ix];
ctl.Dispose();
}
tlp4.BringToFront();
control.Dock = DockStyle.Fill;
tlp4.Controls.Add(control);
control.Focus();
tableLayoutPanel2.Visible = false;
tlp4.Visible = true;
}