simple user control / panel question
-
OK, I'm just trying to learn how to use panels. I have a panel "pnlWorkArea" and I have a user control "uctrlNewCostTracker". I just want to write a button action that will make the user control show up in the panel (the button and the panel are both on frmMain). This should be easy, right? The ends can never justify the means. It is the means that determine the ends.
-
OK, I'm just trying to learn how to use panels. I have a panel "pnlWorkArea" and I have a user control "uctrlNewCostTracker". I just want to write a button action that will make the user control show up in the panel (the button and the panel are both on frmMain). This should be easy, right? The ends can never justify the means. It is the means that determine the ends.
-
OK, I'm just trying to learn how to use panels. I have a panel "pnlWorkArea" and I have a user control "uctrlNewCostTracker". I just want to write a button action that will make the user control show up in the panel (the button and the panel are both on frmMain). This should be easy, right? The ends can never justify the means. It is the means that determine the ends.
I do this frequently.
UcInfo = new ucInfo(this); // Instantiate the UC
UcInfo.Parent = pnl01; // Assign the panel as the UC parent
UcInfo.ShowLookup = false; // I have preprossing in the UC that I want executed
pnl01.Height = UcInfo.Height + 8; // In this case, I'm adjusting the size of the parent panel to the hieght of the UC
UcInfo.Dock = DockStyle.Fill; // Now dock the UC into the panel
pnl01.Dock = DockStyle.Top; // Position the panel on the form
... // There can be other preprocessing you might need done on the UC.
pnl01.Visible = true; // Now show the panel