Various search results are indicating a property or two to adjust to prevent the user ctrl from loosing its size properties:
… example set AutoScaleMode to Inherit in the user control’s designer
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None
or tabPage.Controls.Add(customView); customView.Dock = DockStyle.Fill;
but these are not working for me.
stackoverflow.com/questions/28047102/custom-usercontrols-automatically-resizes-when-hosted-on-a-winform-form
stackoverflow.com/questions/25866362/usercontrol-size-changes-after-inserting-in-form
stackoverflow.com/questions/2733521/sizing-issues-while-adding-a-net-usercontrol-to-a-tabpageMy tab control has a tab page that houses a flowlayout panel.
My panel gets user control added on form load.
<I believe> you have to set the tab page to selected (WiseJ Visible) PER::==>
[ https://wisej.com/support/question/tab-control Luca (ITG) answered Jul 26, 2016 – 7:34 pm ]
to affect its children, I.E. add the user control to the panel.
Once built up on load I return the selected tab to some other tab that that should appear on load, after hydrating this one in question.
I can watch my user control ( during the placement onLoad into its flowlayout panel and tab page) get added to the panel in the tab page and WATCH it loose its height property as soon as it becomes a child control of the panel.
What are the required settings to allow my user control to maintain its size properties when being programmatically added to a panel on a tab page please ?
I cannot easily whip up a sample exemplifying this behavior. My apologies.
ADDENDUM:
I was able to get the user control to display by changing the layout panel from flow to table.
I’m dbl checking settings, as I assuredly may have re ordered or added more property settings in my attempts.
LIKE:
pnlLines.AutoSizeMode = AutoSizeMode.GrowOnly;
pnlLines.AutoSize = false;
Set the Size and do not set AutoSize to true. Also set the Autoscaling to None, the default I believe if Font which autoscales if you change the font of the panel at runtime to something different than the original one. There is no dpi scaling since dpi scaling makes no sense in a browser.
When you set the Size nothing in Wisej.NET will change the size of your control. The only properties that change it are Anchors and Dock but you should set those unless you want to alter the size based on the container’s layout engine.
Please login first to submit.