IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Windows Forms Discussion :

[C# 2.0] Composants d'une fenêtre qui s'affiche un à un


Sujet :

Windows Forms

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Inscrit en
    Mars 2002
    Messages
    118
    Détails du profil
    Informations forums :
    Inscription : Mars 2002
    Messages : 118
    Par défaut [C# 2.0] Composants d'une fenêtre qui s'affiche un à un
    Bonjour,

    J'ai développé un petit UserControl avec 5 textbox et label... Cependant, quand je demande a ce UserControl de s'afficher, chacun des contrôles enfant du UserControl s'affichent, mais un à un dans l'espace d'une seconde ! J'ai enlevé tout code sur les OnLoad, les constructeurs, etc. et toujours le même résultat.

    Ci-dessous, il s'agit du code que j'utilise pour afficher mon UserControl dans ma form...

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    _objContainer.SuspendLayout();
    _objContainer.Controls.Clear();
    _objContainer.Controls.Add(_objUserControl);
    _objContainer.ResumeLayout(false);
    Comment éliminer cet effet là? Je planche là-dessus depuis plusieurs heure et je ne trouve pas!

    Merci beaucoup de votre aide!

  2. #2
    Membre Expert Avatar de Mose
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    1 143
    Détails du profil
    Informations personnelles :
    Âge : 48
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 1 143
    Par défaut
    J'ai aussi des pb avec les contrôles du fx2.0.
    Ils scintillent à mort. Pas encore de soluce.

  3. #3
    Membre confirmé
    Inscrit en
    Mars 2002
    Messages
    118
    Détails du profil
    Informations forums :
    Inscription : Mars 2002
    Messages : 118
    Par défaut
    fx 2.0 == .NET 2.0 ?

  4. #4
    Membre Expert Avatar de Mose
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    1 143
    Détails du profil
    Informations personnelles :
    Âge : 48
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 1 143
    Par défaut
    framework 2.0, vi vi vi.
    comme dans dotnetfx.exe

  5. #5
    Membre confirmé
    Inscrit en
    Mars 2002
    Messages
    118
    Détails du profil
    Informations forums :
    Inscription : Mars 2002
    Messages : 118
    Par défaut
    Bonjour à tous!

    Je reprends ma question... En bref, elle est essentiellement la même que je pose ci-dessus, mais avec un exemple de monde code...

    Merci de votre aide/idées !

    Form1.cs

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
     
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
     
    namespace WindowsApplication2
    {
        public class Form1 : Form
        {
            /// <summary>
            /// Required designer variable.
            /// </summary>
            private System.ComponentModel.IContainer components = null;
     
            /// <summary>
            /// Clean up any resources being used.
            /// </summary>
            /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
            protected override void Dispose(bool disposing)
            {
                if (disposing && (components != null))
                {
                    components.Dispose();
                }
                base.Dispose(disposing);
            }
     
            #region Windows Form Designer generated code
     
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {
                this.splitContainer1 = new System.Windows.Forms.SplitContainer();
                this.button1 = new System.Windows.Forms.Button();
                this.splitContainer1.Panel2.SuspendLayout();
                this.splitContainer1.SuspendLayout();
                this.SuspendLayout();
                // 
                // splitContainer1
                // 
                this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
                this.splitContainer1.Location = new System.Drawing.Point(0, 0);
                this.splitContainer1.Name = "splitContainer1";
                // 
                // splitContainer1.Panel2
                // 
                this.splitContainer1.Panel2.Controls.Add(this.button1);
                this.splitContainer1.Size = new System.Drawing.Size(642, 305);
                this.splitContainer1.SplitterDistance = 425;
                this.splitContainer1.TabIndex = 0;
                // 
                // button1
                // 
                this.button1.Location = new System.Drawing.Point(21, 22);
                this.button1.Name = "button1";
                this.button1.Size = new System.Drawing.Size(75, 23);
                this.button1.TabIndex = 0;
                this.button1.Text = "button1";
                this.button1.UseVisualStyleBackColor = true;
                this.button1.Click += new System.EventHandler(this.button1_Click);
                // 
                // Form1
                // 
                this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.ClientSize = new System.Drawing.Size(642, 305);
                this.Controls.Add(this.splitContainer1);
                this.Name = "Form1";
                this.Text = "Form1";
                this.splitContainer1.Panel2.ResumeLayout(false);
                this.splitContainer1.ResumeLayout(false);
                this.ResumeLayout(false);
     
            }
     
            #endregion
     
            private System.Windows.Forms.SplitContainer splitContainer1;
            private System.Windows.Forms.Button button1;
     
     
            public Form1()
            {
                InitializeComponent();
            }
     
            private void ShowUserControl(UserControl _objUserControl, Control _objContainer)
            {
                _objUserControl.Location = new Point(0, 0);
                _objUserControl.Size =
                    new Size(_objContainer.Width, _objContainer.Height);
                _objUserControl.Anchor = AnchorStyles.Top | AnchorStyles.Bottom |
                                         AnchorStyles.Left | AnchorStyles.Right;
     
                _objContainer.SuspendLayout();
     
                _objContainer.Controls.Clear();
                _objContainer.Controls.Add(_objUserControl);
     
                _objContainer.ResumeLayout();
            }
     
            private void button1_Click(object sender, EventArgs e)
            {
                ShowUserControl(new UserControl1(), splitContainer1.Panel1);
            }
        }
    }

    UserControl1.cs

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
     
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Data;
    using System.Text;
    using System.Windows.Forms;
     
    namespace WindowsApplication2
    {
        public class UserControl1 : UserControl
        {
            /// <summary> 
            /// Required designer variable.
            /// </summary>
            private System.ComponentModel.IContainer components = null;
     
            /// <summary> 
            /// Clean up any resources being used.
            /// </summary>
            /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
            protected override void Dispose(bool disposing)
            {
                if (disposing && (components != null))
                {
                    components.Dispose();
                }
                base.Dispose(disposing);
            }
     
            #region Component Designer generated code
     
            /// <summary> 
            /// Required method for Designer support - do not modify 
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {
                this.components = new System.ComponentModel.Container();
                this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
                this.txtStreet = new System.Windows.Forms.TextBox();
                this.txtCity = new System.Windows.Forms.TextBox();
                this.ddlState = new System.Windows.Forms.ComboBox();
                this.ddlCountry = new System.Windows.Forms.ComboBox();
                this.txtPostalCode = new System.Windows.Forms.TextBox();
                this.lblStreet = new System.Windows.Forms.Label();
                this.lblCity = new System.Windows.Forms.Label();
                this.lblStateProvince = new System.Windows.Forms.Label();
                this.lblPostalCode = new System.Windows.Forms.Label();
                this.lblCountry = new System.Windows.Forms.Label();
                this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
                this.tableLayoutPanel.SuspendLayout();
                ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
                this.SuspendLayout();
                // 
                // tableLayoutPanel1
                // 
                this.tableLayoutPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                            | System.Windows.Forms.AnchorStyles.Right)));
                this.tableLayoutPanel.ColumnCount = 2;
                this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F));
                this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
                this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
                this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
                this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
                this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
                this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
                this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
                this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
                this.tableLayoutPanel.Controls.Add(this.txtStreet, 1, 2);
                this.tableLayoutPanel.Controls.Add(this.txtCity, 1, 3);
                this.tableLayoutPanel.Controls.Add(this.ddlState, 1, 4);
                this.tableLayoutPanel.Controls.Add(this.ddlCountry, 1, 1);
                this.tableLayoutPanel.Controls.Add(this.txtPostalCode, 1, 5);
                this.tableLayoutPanel.Controls.Add(this.lblStreet, 0, 2);
                this.tableLayoutPanel.Controls.Add(this.lblCity, 0, 3);
                this.tableLayoutPanel.Controls.Add(this.lblStateProvince, 0, 4);
                this.tableLayoutPanel.Controls.Add(this.lblPostalCode, 0, 5);
                this.tableLayoutPanel.Controls.Add(this.lblCountry, 0, 1);
                this.tableLayoutPanel.Location = new System.Drawing.Point(0, 0);
                this.tableLayoutPanel.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
                this.tableLayoutPanel.Name = "tableLayoutPanel";
                this.tableLayoutPanel.RowCount = 6;
                this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 15F));
                this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
                this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
                this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
                this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
                this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
                this.tableLayoutPanel.Size = new System.Drawing.Size(618, 165);
                this.tableLayoutPanel.TabIndex = 0;
                // 
                // txtStreet
                // 
                this.txtStreet.Dock = System.Windows.Forms.DockStyle.Fill;
                this.errorProvider.SetIconAlignment(this.txtStreet, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
                this.txtStreet.Location = new System.Drawing.Point(103, 45);
                this.txtStreet.MinimumSize = new System.Drawing.Size(4, 26);
                this.txtStreet.Multiline = true;
                this.txtStreet.Name = "txtStreet";
                this.txtStreet.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
                this.txtStreet.Size = new System.Drawing.Size(512, 32);
                this.txtStreet.TabIndex = 1;
                // 
                // txtCity
                // 
                this.txtCity.Dock = System.Windows.Forms.DockStyle.Fill;
                this.errorProvider.SetIconAlignment(this.txtCity, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
                this.txtCity.Location = new System.Drawing.Point(103, 83);
                this.txtCity.Name = "txtCity";
                this.txtCity.Size = new System.Drawing.Size(512, 20);
                this.txtCity.TabIndex = 2;
                // 
                // ddlState
                // 
                this.ddlState.Dock = System.Windows.Forms.DockStyle.Fill;
                this.ddlState.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
                this.ddlState.FormattingEnabled = true;
                this.errorProvider.SetIconAlignment(this.ddlState, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
                this.ddlState.Location = new System.Drawing.Point(103, 109);
                this.ddlState.Name = "ddlState";
                this.ddlState.Size = new System.Drawing.Size(512, 21);
                this.ddlState.TabIndex = 3;
                // 
                // ddlCountry
                // 
                this.ddlCountry.Dock = System.Windows.Forms.DockStyle.Fill;
                this.ddlCountry.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
                this.ddlCountry.FormattingEnabled = true;
                this.errorProvider.SetIconAlignment(this.ddlCountry, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
                this.ddlCountry.Location = new System.Drawing.Point(103, 18);
                this.ddlCountry.Name = "ddlCountry";
                this.ddlCountry.Size = new System.Drawing.Size(512, 21);
                this.ddlCountry.TabIndex = 0;
                // 
                // txtPostalCode
                // 
                this.txtPostalCode.Dock = System.Windows.Forms.DockStyle.Fill;
                this.errorProvider.SetIconAlignment(this.txtPostalCode, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
                this.txtPostalCode.Location = new System.Drawing.Point(103, 136);
                this.txtPostalCode.Name = "txtPostalCode";
                this.txtPostalCode.Size = new System.Drawing.Size(512, 20);
                this.txtPostalCode.TabIndex = 4;
                // 
                // lblStreet
                // 
                this.lblStreet.AutoSize = true;
                this.lblStreet.Dock = System.Windows.Forms.DockStyle.Fill;
                this.lblStreet.ImeMode = System.Windows.Forms.ImeMode.NoControl;
                this.lblStreet.Location = new System.Drawing.Point(3, 42);
                this.lblStreet.Name = "lblStreet";
                this.lblStreet.Size = new System.Drawing.Size(94, 38);
                this.lblStreet.TabIndex = 0;
                this.lblStreet.Text = "lblStreet";
                this.lblStreet.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                // 
                // lblCity
                // 
                this.lblCity.AutoSize = true;
                this.lblCity.Dock = System.Windows.Forms.DockStyle.Fill;
                this.lblCity.ImeMode = System.Windows.Forms.ImeMode.NoControl;
                this.lblCity.Location = new System.Drawing.Point(3, 80);
                this.lblCity.Name = "lblCity";
                this.lblCity.Size = new System.Drawing.Size(94, 26);
                this.lblCity.TabIndex = 0;
                this.lblCity.Text = "lblCity";
                this.lblCity.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                // 
                // lblStateProvince
                // 
                this.lblStateProvince.AutoSize = true;
                this.lblStateProvince.Dock = System.Windows.Forms.DockStyle.Fill;
                this.lblStateProvince.ImeMode = System.Windows.Forms.ImeMode.NoControl;
                this.lblStateProvince.Location = new System.Drawing.Point(3, 106);
                this.lblStateProvince.Name = "lblStateProvince";
                this.lblStateProvince.Size = new System.Drawing.Size(94, 27);
                this.lblStateProvince.TabIndex = 0;
                this.lblStateProvince.Text = "lblStateProvince";
                this.lblStateProvince.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                // 
                // lblPostalCode
                // 
                this.lblPostalCode.AutoSize = true;
                this.lblPostalCode.Dock = System.Windows.Forms.DockStyle.Fill;
                this.lblPostalCode.ImeMode = System.Windows.Forms.ImeMode.NoControl;
                this.lblPostalCode.Location = new System.Drawing.Point(3, 133);
                this.lblPostalCode.Name = "lblPostalCode";
                this.lblPostalCode.Size = new System.Drawing.Size(94, 32);
                this.lblPostalCode.TabIndex = 0;
                this.lblPostalCode.Text = "lblPostalCode";
                this.lblPostalCode.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                // 
                // lblCountry
                // 
                this.lblCountry.AutoSize = true;
                this.lblCountry.Dock = System.Windows.Forms.DockStyle.Fill;
                this.lblCountry.ImeMode = System.Windows.Forms.ImeMode.NoControl;
                this.lblCountry.Location = new System.Drawing.Point(3, 15);
                this.lblCountry.Name = "lblCountry";
                this.lblCountry.Size = new System.Drawing.Size(94, 27);
                this.lblCountry.TabIndex = 0;
                this.lblCountry.Text = "lblCountry";
                this.lblCountry.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                // 
                // errorProvider
                // 
                this.errorProvider.ContainerControl = this;
                // 
                // AddressUC
                // 
                this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.Controls.Add(this.tableLayoutPanel);
                this.DoubleBuffered = true;
                this.Name = "AddressUC";
                this.Size = new System.Drawing.Size(618, 176);
                this.tableLayoutPanel.ResumeLayout(false);
                this.tableLayoutPanel.PerformLayout();
                ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
                this.ResumeLayout(false);
     
            }
     
            #endregion
     
            private System.Windows.Forms.TableLayoutPanel tableLayoutPanel;
            private System.Windows.Forms.TextBox txtStreet;
            private System.Windows.Forms.TextBox txtCity;
            private System.Windows.Forms.ComboBox ddlState;
            private System.Windows.Forms.ComboBox ddlCountry;
            private System.Windows.Forms.TextBox txtPostalCode;
            private System.Windows.Forms.Label lblStreet;
            private System.Windows.Forms.Label lblCity;
            private System.Windows.Forms.Label lblStateProvince;
            private System.Windows.Forms.Label lblPostalCode;
            private System.Windows.Forms.Label lblCountry;
            private System.Windows.Forms.ErrorProvider errorProvider;
     
            public UserControl1()
            {
                InitializeComponent();
            }
        }
    }

  6. #6
    Invité de passage
    Inscrit en
    Décembre 2006
    Messages
    1
    Détails du profil
    Informations forums :
    Inscription : Décembre 2006
    Messages : 1
    Par défaut a mon avis !
    bonjour a tous !
    a mon avis,il faut ajouter un "reference" du Usercontrol. vous choisiez "reference" ,choiez "browse" et cherchez le dll du usercontrol. Et alors, le usercontrol est ajoute dans votre toolbox , vous le "drag" dans votre form et vous l'utilisez comme un composant normal

  7. #7
    Membre confirmé
    Inscrit en
    Mars 2002
    Messages
    118
    Détails du profil
    Informations forums :
    Inscription : Mars 2002
    Messages : 118
    Par défaut
    Citation Envoyé par ducpm
    bonjour a tous !
    a mon avis,il faut ajouter un "reference" du Usercontrol. vous choisiez "reference" ,choiez "browse" et cherchez le dll du usercontrol. Et alors, le usercontrol est ajoute dans votre toolbox , vous le "drag" dans votre form et vous l'utilisez comme un composant normal
    Pardon ?

  8. #8
    Membre Expert Avatar de Mose
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    1 143
    Détails du profil
    Informations personnelles :
    Âge : 48
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 1 143
    Par défaut
    ducpm suggère d'utiliser le designer et la toolbox de VS.Net pour ajouter le contrôle de façon statique dans ta page.

    Je complèterai en ajoutant que ce contrôle doit être initialisé avec Visible = false afin qu'il n'apparaisse pas au début, ta méthode ShowControl ne servant alors qu'à mettre Visible à vrai.

    margagn : pourquoi génères-tu ce contrôle dynamiquement ?
    Est-ce un besoin spécifique ou seulement parce que tu ignorais comment faire de façon statique ?

  9. #9
    Membre confirmé
    Inscrit en
    Mars 2002
    Messages
    118
    Détails du profil
    Informations forums :
    Inscription : Mars 2002
    Messages : 118
    Par défaut
    Citation Envoyé par Mose
    ducpm suggère d'utiliser le designer et la toolbox de VS.Net pour ajouter le contrôle de façon statique dans ta page.
    Je connais bien sur cette facon de faire!

    Citation Envoyé par Mose
    Je complèterai en ajoutant que ce contrôle doit être initialisé avec Visible = false afin qu'il n'apparaisse pas au début, ta méthode ShowControl ne servant alors qu'à mettre Visible à vrai.
    Pas certain que je puisse faire cela...

    Citation Envoyé par Mose
    margagn : pourquoi génères-tu ce contrôle dynamiquement ?
    Est-ce un besoin spécifique ou seulement parce que tu ignorais comment faire de façon statique ?
    J'ai un interface principal dans laquelle je dois afficher plus d'un UserControl et cela, dynamiquement. Si un utilisateur appuie sur le bouton "Address", c'est le contrôle d'adresse qui apparait, si c'est "Client", le contrôle client apparait et ainsi de suite... Ca donne un look d'interface à la Microsoft Money...

    De la pourquoi j'ai créé la fonction "ShowUserControl" qui prend un UserControl et un Container en paramètres.

  10. #10
    Membre Expert Avatar de Mose
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    1 143
    Détails du profil
    Informations personnelles :
    Âge : 48
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 1 143
    Par défaut
    Pourquoi pas le Visible = false ?
    Je l'utilise pas mal et ça marche plutôt bien...
    Dans un SplitContainer, par exemple, si un des deux contrôles est invisible, le contrôle qui reste va prendre toute la place du container. Ca ne fait donc pas un gros vide tout moche dans ta fenêtre.

    Ceci dit, ta méthode dynamique fonctionne aussi, mais avec visible, t'as une chance de limiter le scintillement.

Discussions similaires

  1. une fentre qui s'affiche et qui se ferme
    Par elmcherqui dans le forum Qt
    Réponses: 1
    Dernier message: 01/07/2008, 09h14
  2. [JavaScript] Une fenêtre qui a du retour
    Par dontDeleteMe dans le forum Général JavaScript
    Réponses: 6
    Dernier message: 22/02/2007, 15h59
  3. [VB.Net]Une fenêtre qui montre le contenu d’une table.
    Par yassin101 dans le forum Windows Forms
    Réponses: 2
    Dernier message: 10/11/2006, 22h32
  4. Réponses: 10
    Dernier message: 15/10/2006, 18h23
  5. Faire une fenêtre qui reste au premier plan
    Par Mandelbrot dans le forum Windows
    Réponses: 6
    Dernier message: 13/03/2006, 20h34

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo