views:

637

answers:

1

I am unable to figure out how to make my user control react to the resize event of a form.
The usercontrol(s) exist in a tab control of my main form.
The usercontrol(s) are anchored to all sides of the tab control or is it tab page?
The tab control is anchored to all sides of the form.
When I resize my main form the tab control resizes correctly but the usercontrol does not.

[SUMMARY]
DataBoxUserControl
- A user control with a button and a textbox.
- The textbox has it's sides anchored to the usercontrol.

MainForm
- Has a tabcontrol that is anchored to all sides of the form.
- The tab controls have my DataBoxUserControl which has it's sides anchored to the tab control.

Resizing the MainForm resizes the tab control but not the user control.

[WHAT ELSE HAVE I TRIED]
1. I've tried placing a panel control in each tab page and anchoring the panel. Then I placed the user control in the panel and anchor it. Either I'm doing it wrong but that didn't work either.
2. I read somewhere to try register the resize event of the main form to the user control. But I don't really understand that and I can't seem to find where I saw that again.

I am using c# and .net 3.5

+1  A: 

I believe you need to set the dock property of the user control to "fill" to have it auto resize to an area.

Drakonite
Many apologies. I forgot to set the anchor in the usercontrol itself. Thanks.
Gavin Chin