Click here to Skip to main content
15,611,626 members
Please Sign up or sign in to vote.
0.00/5 (No votes)

I have created a windows form with two panels with width 25:75 ratio. That is 25 ratio is the sidemenu and the other panel is Main menu/screen of app.So i used usercontrol and dragged & dropped it on the Main screen of form when user clicks the respective button on the sidemenu then the usercontrol is seen.
Also the side menu has a partial hide feature the is a three lined button on top right of sidemenu panel when user clicks that button the menu partially hides (basically decreasing width of sidemenu and increasing the with of main menu).
The problem is usercontrol has a tabcontrol in it when user clicks hide button on sidemenu the mainmenu width increases but it leaves the width of tabcontrol as it is.
I want to also change the width of tabcontrol when user clicks hide button on sidemenu, i am not getting access to tabcontrols width which is in usercontrol in panel in form...

What I have tried:

I have tried to access the width of tabb control as follows:

//inside hie button in panel1 of form1
private void hidemenu_click()
  usercontrol1.tabcontrol1.width= mainmenu.width;

but there isn't any suggestion showing by intellisense.... simply showing error
//are you missing a using reference or an assembly reference?
Updated 22-Dec-17 7:09am

1 solution

* Open the user control in the designer.
* Select the tab control.
* In the property grid, change the "Modifiers" to public.

Or, open the user control's code file, and add a public property to get and set the width of the tab control.
public int TabControlWidth
    get { return tabcontrol1.Width; }
    set { tabcontrol1.Width = value; }
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900