Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Prevent designer to resize the usercontrol
Message
De
05/08/2005 14:15:29
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01038491
Message ID:
01038964
Vues:
19
>I will have to play around with it for a while.

Have fun. The suggestion I made about putting the size in the Load event definitely works though ... I tried it before I posted it, just to be sure. =)

~~Bonnie



>Bonnie,
>I am glad my rambling made sense. <s>
>I do understand the negative side effects of that I am asking and trying to do. It might be code that I just add while in the design process and then hopefully remember to remove for a final version <bg>. While I am designing a user control I often end up changing the size quite often and I would like the size change to be reflected imediately when I rebuild. Usually the control is put on a test form during design so I don't really care if the control overlaps anything.
>
>I will have to play around with it for a while.
>
>Thanks,
>Einar
>
>
>>OK, now you make sense, but are you really sure you want to do this? I can see why the default behavior is to leave it at the size it was orignally designed at. If you have dropped a user control on a form, chances are that it's on that form with other controls ... by setting it up to automatically re-size it to a new size, you may throw off the design of your existing form (the new size of the user control may now overlap existing controls already on the form).
>>
>>But, if you still want to have this behavior, you simply need to copy the setting of the size property (from the InitializeComponent) and put it also in the user control's Load event:
>>
>>private void BBControl_Load(object sender, System.EventArgs e)
>>{
>>	this.Size = new System.Drawing.Size(376, 184);
>>}
>>
>>
>>~~Bonnie
>>
>>
>>>>>How can I prevent the designer from resizing a user control? (without physical threats<s>)<
>>>>
>>>>Where is this happening? When you drop a user control on a Form? Or after saving a Form, when you call it back up again? Typically this is not an issue ... maybe you have set some properties that keep re-setting the control's size?
>>>>
>>>>~~Bonnie
>>>
>>>Maybe I didn't explain myself clearly (happends when I get excited).
>>>OK. I create a new project. I create a user control (lets say it has 2 radio buttons in it). I add the user control to a form and all is good, until I need to add another radio button to the usercontrol. I add a 3rd radiobutton to the usercontrol, as a result of this the size of the usercontrol has to change. I recompile and go back to the form. The instance of the user control on the form has 3 radiobuttons but I can't see the 3rd radio button (or can only see part of it). So I resize the instance of the user control on the form.
>>>Now what I really want is for the instance of the usercontrol on the form to change size automatically when the user control class changes size.
>>>
>>>After typing all this I noticed that in this thread what I asked for is not allowing the instance to change size. Similar to when you add a base class textbox to the form you can make the control height change unless you change the control to multiline=true.
>>>Hmm I am starting to think this could be done in the OnPaint event.
>>>
>>>Is my rambling making any sense? :) (I am still upset about the listview <s>)
>>>
>>>Einar
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform