Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Auto-Generated Code Question
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01427766
Message ID:
01427768
Vues:
53
>I created a user control with a property called Distance:
>
>
>private int _Distance = 0;
>[Description("Returns or sets the distance of the control from the left or top edge of the parent container")]
>[DefaultValue(0)]
>[Browsable(true)]
>[Category("Stuff")]
>public int Distance
>{
>    get { return _Distance; }
>    set
>    {
>        if (value > -1)
>        {
>            _Distance = value;
>
>            if (_Orientation == Orientation.Horizontal)
>            {
>                Top = _Distance;
>            }
>            else
>            {
>                Left = _Distance;
>            }
>
>        }
>        else
>        {
>            throw new Exception("Invalid value");
>        }
>    }
>}
>
>
>I also created some other properties.
>
>When I drop this control on a form, in the auto generated code I see:
>
>
>this.MyControl.Location = new System.Drawing.Point(273, 66);
>this.MyControl.Name = "MyControl";
>this.MyControl.Size = new System.Drawing.Size(5, 150);
>this.MyControl.Distance = 15;
>this.MyControl.TabIndex = 0;
>
>
>Why is the Distance property here and not the others? The property is in bold in the prop sheet, so something is setting it. But all I did was drop it on the form and it's being set.

Did you set Distance to be 15 in the Property Sheet?
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform