Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Designer serialization
Message
De
29/01/2007 06:54:36
 
 
À
28/01/2007 05:04:31
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01189851
Message ID:
01189997
Vues:
6
>Hi,
>
>>>>this.MyControl.MyFormCaption = this.Text;
>Let say I want to always set current form.text to myControl.MyFormCaption. How could I do this ?

You want the form caption to be set at design time when the control is dropped onto the surface? Maybe something like:
    public class TestControl : Button
    {
        private string MyFormCaption = "Hello World";

        protected override void InitLayout()
        {
            base.InitLayout();
            Control o = this;
            while (!(o is System.Windows.Forms.Form))
            {
                o = (Control) o.GetContainerControl();
            }
            o.Text = this.MyFormCaption;
        }
    }
You'd need a safer way of detecting a containing form though....
>
>Also, myControl could be dropped to user control. In this case, I would like to
>
>this.MyControl.MyFormCaption = this.ParentForm.Text; //whereby this -> usercontrol
Don't see how you can achieve that - when you add the control to the usercontrol the usercontrol won't be sited on a form. You'd probably need to build the above type logic into the usercontrol as well....
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform