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#] Cacher des onglet(s) [FAQ]


Sujet :

Windows Forms

  1. #1
    Membre actif

    Profil pro
    Inscrit en
    Décembre 2002
    Messages
    146
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Décembre 2002
    Messages : 146
    Points : 204
    Points
    204
    Par défaut [C#] Cacher des onglet(s)
    j'ai ajouté cinq tabPages (onglets) et je souhaite en caché deux tabPages
    Mon code ne fonctionne pas C'est à dire pas d'erreur de compilation Mais cela ne s'execute pas

    Merci d'avance pour votre aide


    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
    using System;
    using System.Drawing;
    using System.Collections;
    using System.Windows.Forms;
    using System.Data;
     
    namespace SmartDeviceApplication2
    {
    	/// <summary>
    	/// Description résumée de Form1.
    	/// </summary>
    	public class Form1 : System.Windows.Forms.Form
    	{
    		private System.Windows.Forms.TabControl tabControl1;
    		private System.Windows.Forms.TabPage tabPage1;
    		private System.Windows.Forms.TabPage tabPage2;
    		private System.Windows.Forms.TabPage tabPage3;
    		private System.Windows.Forms.TabPage tabPage4;
    		private System.Windows.Forms.TabPage tabPage5;
    		private System.Windows.Forms.MainMenu mainMenu1;
     
    		public Form1()
    		{
    			//
    			// Requis pour la prise en charge du Concepteur Windows Forms
    			//
    			InitializeComponent();
     
    			//
    			// TODO : ajoutez le code du constructeur après l'appel à InitializeComponent
    			//
    		}
    		/// <summary>
    		/// Nettoyage des ressources utilisées.
    		/// </summary>
    		protected override void Dispose( bool disposing )
    		{
    			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.mainMenu1 = new System.Windows.Forms.MainMenu();
    			this.tabControl1 = new System.Windows.Forms.TabControl();
    			this.tabPage1 = new System.Windows.Forms.TabPage();
    			this.tabPage2 = new System.Windows.Forms.TabPage();
    			this.tabPage3 = new System.Windows.Forms.TabPage();
    			this.tabPage4 = new System.Windows.Forms.TabPage();
    			this.tabPage5 = new System.Windows.Forms.TabPage();
    			// 
    			// tabControl1
    			// 
    			this.tabControl1.Controls.Add(this.tabPage1);
    			this.tabControl1.Controls.Add(this.tabPage2);
    			this.tabControl1.Controls.Add(this.tabPage3);
    			this.tabControl1.Controls.Add(this.tabPage4);
    			this.tabControl1.Controls.Add(this.tabPage5);
    			this.tabControl1.SelectedIndex = 0;
    			this.tabControl1.Size = new System.Drawing.Size(240, 232);
     
    			// 
    			// tabPage1
    			// 
    			this.tabPage1.Location = new System.Drawing.Point(4, 4);
    			this.tabPage1.Size = new System.Drawing.Size(232, 206);
    			// 
    			// tabPage2
    			// 
    			this.tabPage2.Location = new System.Drawing.Point(4, 4);
    			this.tabPage2.Size = new System.Drawing.Size(232, 206);
    			// 
    			// tabPage3
    			// 
    			this.tabPage3.Location = new System.Drawing.Point(4, 4);
    			this.tabPage3.Size = new System.Drawing.Size(232, 206);
    			// 
    			// tabPage4
    			// 
    			this.tabPage4.Location = new System.Drawing.Point(4, 4);
    			this.tabPage4.Size = new System.Drawing.Size(232, 206);
    			this.tabPage4.Text = "4";
    			// 
    			// tabPage5
    			// 
    			this.tabPage5.Location = new System.Drawing.Point(4, 4);
    			this.tabPage5.Size = new System.Drawing.Size(232, 206);
    			this.tabPage5.Text = "5";
    			// 
    			// Form1
    			// 
    			this.Controls.Add(this.tabControl1);
    			this.Menu = this.mainMenu1;
    			this.Text = "Form1";
    			this.Load += new System.EventHandler(this.Form1_Load);
     
    		}
    		#endregion
     
    		/// <summary>
    		/// Point d'entrée principal de l'application.
    		/// </summary>
     
    		static void Main() 
    		{
    			Application.Run(new Form1());
    		}
     
    		private void Form1_Load(object sender, System.EventArgs e){
     
    			tabPage4.Hide();
    			tabPage5.Hide();
    		}
     
     
    	}
    }

  2. #2
    Rédacteur
    Avatar de Louis-Guillaume Morand
    Homme Profil pro
    Cloud Architect
    Inscrit en
    Mars 2003
    Messages
    10 839
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Cloud Architect
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2003
    Messages : 10 839
    Points : 28 253
    Points
    28 253
    Par défaut
    ??

  3. #3
    Rédacteur
    Avatar de abelman
    Inscrit en
    Février 2003
    Messages
    1 106
    Détails du profil
    Informations forums :
    Inscription : Février 2003
    Messages : 1 106
    Points : 2 629
    Points
    2 629
    Par défaut
    Pour cacher les tabpages ils faut les enlever de la collection de control de ton tabcontrol. C'est le seul moyen que j'avais trouvé.

  4. #4
    Membre actif

    Profil pro
    Inscrit en
    Décembre 2002
    Messages
    146
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Décembre 2002
    Messages : 146
    Points : 204
    Points
    204
    Par défaut
    Merci

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

Discussions similaires

  1. [UI] Cacher des onglets
    Par microJaP dans le forum jQuery
    Réponses: 1
    Dernier message: 15/10/2014, 23h35
  2. [XL-2007] Macro pour cacher des onglets
    Par Kyoichi95 dans le forum Macros et VBA Excel
    Réponses: 13
    Dernier message: 12/12/2012, 01h44
  3. Comment cacher des onglets tout en les utilisant
    Par Sherman750 dans le forum Macros et VBA Excel
    Réponses: 8
    Dernier message: 04/12/2012, 16h45
  4. cacher des onglets - VB 2010 express
    Par khamett dans le forum VB.NET
    Réponses: 5
    Dernier message: 30/04/2010, 09h37
  5. [MediaWiki] Cacher des onglets, et aligner en colonne
    Par Scroll dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 6
    Dernier message: 09/01/2008, 22h54

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