Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Resizing Automatically...BUG????
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00912903
Message ID:
00913151
Vues:
28
Shawn,

This is actually a VS .NET / Windows Forms problem, and it all boils down to this: The last object to be resized is the form itself. Here's the details:

When the form instantiates, the code that instantiates and resizes the TabControl fires first, then the code that instantiates the TabControl’s contained controls fires next…INCLUDING the code that anchors the TabControl to the form. Next, code that resizes the form is fired! Since the TabControl is already a larger size than the form (because it was sized first), when the form is resized, the TabControl is resized proportionately, making it larger than it should be (and in fact, too large for the containing form).

I tried lots of different workarounds for this, but since you can’t control what the VS .NET designers are doing, the only way I could get around it is to set the anchoring property of the TabControl AFTER the form is already resized.

I put this code in the form’s constructor AFTER the call to InitializeComponent:
this.TabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
         | System.Windows.Forms.AnchorStyles.Left) 
         | System.Windows.Forms.AnchorStyles.Right)));
Since the TabControl is not anchored until after the form is resized, it works like a charm.

Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform