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 :

les label du Apropos invisibles


Sujet :

Windows Forms

  1. #1
    Membre chevronné Avatar de petitours
    Homme Profil pro
    Ingénieur développement matériel électronique
    Inscrit en
    Février 2003
    Messages
    1 916
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Ingénieur développement matériel électronique
    Secteur : Industrie

    Informations forums :
    Inscription : Février 2003
    Messages : 1 916
    Points : 1 930
    Points
    1 930
    Par défaut les label du Apropos invisibles
    Bonjour

    J'ai ajouté la class Apropos que propose .net par défaut et j'ai obtenu la fenêtre A propos qui va bien, un peu vilaine par défaut.
    Pour la mettre à mon gout j'ai gardé tous les labels et boutons qui étaient dessus, que j'ai copié et collé sur la form afin de retirer la "Tablegrid Je ne sais pas quoi" qui imposait le positionnement des différents éléments.

    Là dans le concepteur j'ai ma form avec mes labels dessus, tout ont des propriétés a visible, enabled=true mais quand j'ouvre la fenêtre A propos à l’exécution je ne les vois plus !
    si je leur donne un fond de couleur, je ne vois pas ce fond à l’exécution, comme si les labels étaient en visible = false ! sauf que dans Apropos.Designer.cs ils sont bien définis comme il faut. Dans le concepteur les propriétés sont OK...

    Mais où, quand, par quoi, comment ces labels sont ils modifiés pour que je ne les vois plus à l’exécution ?

    voici le code que j'ai dans Apropos.designer.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
    partial class APropos
        {
            /// <summary>
            /// Variable nécessaire au concepteur.
            /// </summary>
            private System.ComponentModel.IContainer components = null;
     
            /// <summary>
            /// Nettoyage des ressources utilisées.
            /// </summary>
            protected override void Dispose(bool disposing)
            {
                if (disposing && (components != null))
                {
                    components.Dispose();
                }
                base.Dispose(disposing);
            }
     
            #region Code généré par le Concepteur Windows Form
     
            /// <summary>
            /// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
            /// le contenu de cette méthode avec l'éditeur de code.
            /// </summary>
            private void InitializeComponent()
            {
                this.labelProductName = new System.Windows.Forms.Label();
                this.labelVersion = new System.Windows.Forms.Label();
                this.labelCopyright = new System.Windows.Forms.Label();
                this.labelCompanyName = new System.Windows.Forms.Label();
                this.textBoxDescription = new System.Windows.Forms.TextBox();
                this.okButton = new System.Windows.Forms.Button();
                this.pictureBox1 = new System.Windows.Forms.PictureBox();
                ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
                this.SuspendLayout();
                // 
                // labelProductName
                // 
                this.labelProductName.BackColor = System.Drawing.SystemColors.Control;
                this.labelProductName.Location = new System.Drawing.Point(314, 29);
                this.labelProductName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
                this.labelProductName.MaximumSize = new System.Drawing.Size(0, 17);
                this.labelProductName.Name = "labelProductName";
                this.labelProductName.Size = new System.Drawing.Size(268, 17);
                this.labelProductName.TabIndex = 20;
                this.labelProductName.Text = "Nom du produit";
                this.labelProductName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                // 
                // labelVersion
                // 
                this.labelVersion.Location = new System.Drawing.Point(314, 46);
                this.labelVersion.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
                this.labelVersion.MaximumSize = new System.Drawing.Size(0, 17);
                this.labelVersion.Name = "labelVersion";
                this.labelVersion.Size = new System.Drawing.Size(262, 17);
                this.labelVersion.TabIndex = 21;
                this.labelVersion.Text = "Version";
                this.labelVersion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                // 
                // labelCopyright
                // 
                this.labelCopyright.Location = new System.Drawing.Point(314, 63);
                this.labelCopyright.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
                this.labelCopyright.MaximumSize = new System.Drawing.Size(0, 17);
                this.labelCopyright.Name = "labelCopyright";
                this.labelCopyright.Size = new System.Drawing.Size(268, 17);
                this.labelCopyright.TabIndex = 22;
                this.labelCopyright.Text = "Copyright";
                this.labelCopyright.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                // 
                // labelCompanyName
                // 
                this.labelCompanyName.Location = new System.Drawing.Point(314, 80);
                this.labelCompanyName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
                this.labelCompanyName.MaximumSize = new System.Drawing.Size(0, 17);
                this.labelCompanyName.Name = "labelCompanyName";
                this.labelCompanyName.Size = new System.Drawing.Size(268, 17);
                this.labelCompanyName.TabIndex = 23;
                this.labelCompanyName.Text = "Nom de la société";
                this.labelCompanyName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                // 
                // textBoxDescription
                // 
                this.textBoxDescription.BorderStyle = System.Windows.Forms.BorderStyle.None;
                this.textBoxDescription.Cursor = System.Windows.Forms.Cursors.Default;
                this.textBoxDescription.Location = new System.Drawing.Point(317, 100);
                this.textBoxDescription.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
                this.textBoxDescription.Multiline = true;
                this.textBoxDescription.Name = "textBoxDescription";
                this.textBoxDescription.ReadOnly = true;
                this.textBoxDescription.Size = new System.Drawing.Size(259, 74);
                this.textBoxDescription.TabIndex = 24;
                this.textBoxDescription.TabStop = false;
                this.textBoxDescription.Text = "Description";
                // 
                // okButton
                // 
                this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                this.okButton.Location = new System.Drawing.Point(401, 189);
                this.okButton.Name = "okButton";
                this.okButton.Size = new System.Drawing.Size(102, 47);
                this.okButton.TabIndex = 25;
                this.okButton.Text = "&OK";
                // 
                // pictureBox1
                // 
                this.pictureBox1.Image = global::Disu.Properties.Resources.logoComplet2;
                this.pictureBox1.Location = new System.Drawing.Point(12, 63);
                this.pictureBox1.Name = "pictureBox1";
                this.pictureBox1.Size = new System.Drawing.Size(275, 131);
                this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
                this.pictureBox1.TabIndex = 26;
                this.pictureBox1.TabStop = false;
                // 
                // APropos
                // 
                this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.ClientSize = new System.Drawing.Size(594, 272);
                this.Controls.Add(this.pictureBox1);
                this.Controls.Add(this.okButton);
                this.Controls.Add(this.textBoxDescription);
                this.Controls.Add(this.labelCompanyName);
                this.Controls.Add(this.labelCopyright);
                this.Controls.Add(this.labelVersion);
                this.Controls.Add(this.labelProductName);
                this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
                this.MaximizeBox = false;
                this.MinimizeBox = false;
                this.Name = "APropos";
                this.Padding = new System.Windows.Forms.Padding(9);
                this.ShowIcon = false;
                this.ShowInTaskbar = false;
                this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
                this.Text = "APropos";
                ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
                this.ResumeLayout(false);
                this.PerformLayout();
     
            }
     
            #endregion
     
            private System.Windows.Forms.Label labelProductName;
            private System.Windows.Forms.Label labelVersion;
            private System.Windows.Forms.Label labelCopyright;
            private System.Windows.Forms.Label labelCompanyName;
            private System.Windows.Forms.TextBox textBoxDescription;
            private System.Windows.Forms.Button okButton;
            private System.Windows.Forms.PictureBox pictureBox1;
    et le code de Apropos.cs, inchangé
    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
        partial class APropos : Form
        {
            public APropos()
            {
                InitializeComponent();
                this.Text = String.Format("À propos de {0}", AssemblyTitle);
                this.labelProductName.Text = AssemblyProduct;
                this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion);
                this.labelCopyright.Text = AssemblyCopyright;
                this.labelCompanyName.Text = AssemblyCompany;
                this.textBoxDescription.Text = AssemblyDescription;
            }
     
            #region Accesseurs d'attribut de l'assembly
     
            public string AssemblyTitle
            {
                get
                {
                    object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
                    if (attributes.Length > 0)
                    {
                        AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
                        if (titleAttribute.Title != "")
                        {
                            return titleAttribute.Title;
                        }
                    }
                    return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
                }
            }
     
            public string AssemblyVersion
            {
                get
                {
                    return Assembly.GetExecutingAssembly().GetName().Version.ToString();
                }
            }
     
            public string AssemblyDescription
            {
                get
                {
                    object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
                    if (attributes.Length == 0)
                    {
                        return "";
                    }
                    return ((AssemblyDescriptionAttribute)attributes[0]).Description;
                }
            }
     
            public string AssemblyProduct
            {
                get
                {
                    object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
                    if (attributes.Length == 0)
                    {
                        return "";
                    }
                    return ((AssemblyProductAttribute)attributes[0]).Product;
                }
            }
     
            public string AssemblyCopyright
            {
                get
                {
                    object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
                    if (attributes.Length == 0)
                    {
                        return "";
                    }
                    return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
                }
            }
     
            public string AssemblyCompany
            {
                get
                {
                    object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
                    if (attributes.Length == 0)
                    {
                        return "";
                    }
                    return ((AssemblyCompanyAttribute)attributes[0]).Company;
                }
            }
            #endregion
     
     
        }
    Merci par avance pour vos lumières sur ce mystère..ca parait tellement simple..
    Il y a 10 sortes de personnes dans le monde : ceux qui comprennent le binaire et les autres

  2. #2
    Membre éprouvé
    Profil pro
    Inscrit en
    Octobre 2006
    Messages
    665
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2006
    Messages : 665
    Points : 1 161
    Points
    1 161
    Par défaut
    Bonjour,
    à mon avis depuis les propriétés du formulaire, mettre les AutoSize des Labels à True.

  3. #3
    Membre chevronné Avatar de petitours
    Homme Profil pro
    Ingénieur développement matériel électronique
    Inscrit en
    Février 2003
    Messages
    1 916
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Ingénieur développement matériel électronique
    Secteur : Industrie

    Informations forums :
    Inscription : Février 2003
    Messages : 1 916
    Points : 1 930
    Points
    1 930
    Par défaut
    Bonjour

    Bien vu ! c'était ca le problème. Mais pourquoi ne gardait il pas la dimension que je lui donnais dans le concepteur comme tous les labels ont toujours fait?...

    Merci
    Il y a 10 sortes de personnes dans le monde : ceux qui comprennent le binaire et les autres

  4. #4
    Membre éprouvé
    Profil pro
    Inscrit en
    Octobre 2006
    Messages
    665
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2006
    Messages : 665
    Points : 1 161
    Points
    1 161
    Par défaut
    Citation Envoyé par petitours Voir le message
    Bonjour
    Mais pourquoi ne gardait il pas la dimension que je lui donnais dans le concepteur comme tous les labels ont toujours fait?...
    Merci
    Re et sauf erreur de ma part,
    vous avez cette ligne :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    this.labelVersion.MaximumSize = new System.Drawing.Size(0, 17);
    Elle prendra le dessus sur toutes valeurs que vous pourrez attribuer à Width et height de Size.
    Faites ce test quelque part :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Console.WriteLine(labelVersion.Size);
    et vous verrez les valeurs de MaximumSize. Le Label se trouve donc réduit à la portion la plus congrue...

    La ligne du haut s'associe avec :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    this.labelVersion.Dock = System.Windows.Forms.DockStyle.Fill;
    Ainsi ce Label occupera toute la largeur de son conteneur sans dépasser 17 pixels de haut.

  5. #5
    Membre chevronné Avatar de petitours
    Homme Profil pro
    Ingénieur développement matériel électronique
    Inscrit en
    Février 2003
    Messages
    1 916
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Ingénieur développement matériel électronique
    Secteur : Industrie

    Informations forums :
    Inscription : Février 2003
    Messages : 1 916
    Points : 1 930
    Points
    1 930
    Par défaut
    Merci pour les précisions
    Il y a 10 sortes de personnes dans le monde : ceux qui comprennent le binaire et les autres

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Données dynamiques dans les Labels
    Par Pedro Varela dans le forum Accès aux données
    Réponses: 4
    Dernier message: 11/12/2006, 14h07
  2. petite question sur les "label"
    Par newixz dans le forum Delphi
    Réponses: 5
    Dernier message: 09/09/2006, 13h04
  3. [VB6] TypeOf ne marche pas avec les Label ?
    Par belfaigore dans le forum VB 6 et antérieur
    Réponses: 14
    Dernier message: 21/04/2006, 14h36
  4. alignez tout les labels
    Par cellestion dans le forum AWT/Swing
    Réponses: 3
    Dernier message: 07/03/2006, 09h42
  5. [Visual Editor] problème avec les Label
    Par Willy7901 dans le forum Eclipse Java
    Réponses: 2
    Dernier message: 22/08/2005, 13h30

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