Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

TABCONTROL VERTICAL


Information sur la source

Catégorie :Control Source .NET ( DotNet ) Classé sous : usercontrol, tabcontrol, vertical Niveau : Débutant Date de création : 24/05/2005 Date de mise à jour : 27/05/2005 11:31:10 Vu : 10 446

Note :
10 / 10 - par 3 personnes
10,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10

Commentaire sur cette source (2)
Ajouter un commentaire et/ou une note

Description

Cliquez pour voir la capture en taille normale
Bon et bien en fait, aprés avoir bataillé de nombreuses heures sur des sites a la recherche d'un TabControl vertical ou d'un menu déroulant si vous préférez (cf screenshot) et n'ayant rien trouver de bien probant j'ai décidé de poster mon travail. Il n'y a pas de quoi s'affoler mais si comme moi vous devez faire un interface dont la majeure partie de la fenetre est occupé par une picturebox alors un menu déroulant vertical sera le bienvenue.

J'ai mis en place 4 panels sur ma form. Chaque panel s'ouvre via les boutons "btnNomDuBouton" et contient d'autres boutons qui engendre des actions (dans mon appli je charge des images, mais a vous de changez leurs fonctionnalités.

Voila deux click sur un même bouton ouvre et ferme le panel correspondant. Un click sur un bouton puis sur un autre ouvre le panel associé et ferme les autres.

N.B: la propriété dock des boutons commandant les panels est à régler en DockStyle.Top
Voila c tt
 

Source

  • #Region "MenuComposant"
  • Public Sub MenuComposant(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnVerins.Click, btnPompes.Click, btnMoteurs.Click, btnDistributeurs.Click
  • ' On récupère le nom du bouton et suivant sont état (true = ouvert; false = fermer)
  • ' on affiche le menu.
  • If sender.name = "btnVerins" Then
  • If _btnEtat = False Then
  • Fermer_Pompe() : Fermer_Moteur() : Fermer_Distributeur()
  • Ouvrir_Verin()
  • ElseIf _btnEtat = True Then
  • Fermer_Verin()
  • End If
  • ElseIf sender.name = "btnPompes" Then
  • If _btnEtat2 = False Then
  • Fermer_Verin() : Fermer_Moteur() : Fermer_Distributeur()
  • Ouvrir_Pompe()
  • ElseIf _btnEtat2 = True Then
  • Fermer_Pompe()
  • End If
  • ElseIf sender.name = "btnMoteurs" Then
  • If _btnEtat3 = False Then
  • Fermer_Pompe() : Fermer_Verin() : Fermer_Distributeur()
  • Ouvrir_Moteur()
  • ElseIf _btnEtat3 Then
  • Fermer_Moteur()
  • End If
  • ElseIf sender.name = "btnDistributeurs" Then
  • If _btnEtat4 = False Then
  • Fermer_Pompe() : Fermer_Moteur() : Fermer_Verin()
  • Ouvrir_Distributeur()
  • ElseIf _btnEtat4 = True Then
  • Fermer_Distributeur()
  • End If
  • End If
  • End Sub
  • Sub Ouvrir_Verin()
  • ' On fixe l'état du bouton et l'image a charger.
  • _btnEtat = True : btnVerins.Image = Image.FromFile("Images\_btnVerins_ON.bmp")
  • ' On dispose les controls de la bonne manière.
  • Panel1.Height = _Height : Panel1.Top = btnVerins.Top
  • Panel2.Height = btnPompes.Height : Panel2.Top = Panel1.Top + Panel1.Height
  • Panel3.Height = btnMoteurs.Height : Panel3.Top = Panel2.Top + btnPompes.Height
  • Panel4.Height = btnDistributeurs.Height : Panel4.Top = Panel3.Top + btnMoteurs.Height
  • End Sub
  • Sub Fermer_Verin()
  • ' On fixe l'état du bouton et l'image a charger
  • _btnEtat = False : btnVerins.Image = Image.FromFile("Images\_btnVerins_OFF.bmp")
  • ' On dispose les controls de la bonne manière.
  • Panel1.Height = btnVerins.Height : Panel1.Top = btnVerins.Top
  • Panel2.Height = btnPompes.Height : Panel2.Top = Panel1.Top + btnVerins.Height - 1
  • Panel3.Height = btnMoteurs.Height : Panel3.Top = Panel2.Top + btnPompes.Height - 1
  • Panel4.Height = btnDistributeurs.Height : Panel4.Top = Panel3.Top + btnMoteurs.Height - 1
  • End Sub
  • Sub Ouvrir_Pompe()
  • ' On fixe l'état du bouton et l'image a charger
  • _btnEtat2 = True : btnPompes.Image = Image.FromFile("Images\_btnPompes_ON.bmp")
  • ' On dispose les controls de la bonne manière.
  • Panel1.Height = btnVerins.Height : Panel1.Top = btnVerins.Top
  • Panel2.Height = _Height2 : Panel2.Top = Panel1.Top + btnVerins.Height
  • Panel3.Height = btnMoteurs.Height : Panel3.Top = Panel2.Top + Panel2.Height
  • Panel4.Height = btnDistributeurs.Height : Panel4.Top = Panel3.Top + Panel3.Height
  • End Sub
  • Sub Fermer_Pompe()
  • ' On fixe l'état du bouton et l'image a charger
  • _btnEtat2 = False : btnPompes.Image = Image.FromFile("Images\_btnPompes_OFF.bmp")
  • ' On dispose les controls de la bonne manière.
  • Panel1.Height = btnVerins.Height : Panel1.Top = btnVerins.Top
  • Panel2.Height = btnPompes.Height : Panel2.Top = Panel1.Top + btnVerins.Height - 1
  • Panel3.Height = btnMoteurs.Height : Panel3.Top = Panel2.Top + btnPompes.Height - 1
  • Panel4.Height = btnDistributeurs.Height : Panel4.Top = Panel3.Top + btnMoteurs.Height - 1
  • End Sub
  • Sub Ouvrir_Moteur()
  • ' On fixe l'état du bouton et l'image a charger
  • _btnEtat3 = True : btnMoteurs.Image = Image.FromFile("Images\_btnMoteurs_ON.bmp")
  • ' On dispose les controls de la bonne manière.
  • Panel1.Height = btnVerins.Height : Panel1.Top = btnVerins.Top
  • Panel2.Height = btnPompes.Height : Panel2.Top = Panel1.Top + btnVerins.Height
  • Panel3.Height = _Height3 : Panel3.Top = Panel2.Top + btnPompes.Height
  • Panel4.Height = btnDistributeurs.Height : Panel4.Top = Panel3.Top + Panel3.Height
  • End Sub
  • Sub Fermer_Moteur()
  • ' On fixe l'état du bouton et l'image a charger
  • _btnEtat3 = False : btnMoteurs.Image = Image.FromFile("Images\_btnMoteurs_OFF.bmp")
  • ' On dispose les controls de la bonne manière.
  • Panel1.Height = btnVerins.Height : Panel1.Top = btnVerins.Top
  • Panel2.Height = btnPompes.Height : Panel2.Top = Panel1.Top + btnVerins.Height - 1
  • Panel3.Height = btnMoteurs.Height : Panel3.Top = Panel2.Top + btnPompes.Height - 1
  • Panel4.Height = btnDistributeurs.Height : Panel4.Top = Panel3.Top + btnMoteurs.Height - 1
  • End Sub
  • Sub Ouvrir_Distributeur()
  • ' On fixe l'état du bouton et l'image a charger
  • _btnEtat4 = True : btnDistributeurs.Image = Image.FromFile("Images\_btnDistributeurs_ON.bmp")
  • ' On dispose les controls de la bonne manière.
  • Panel1.Height = btnVerins.Height : Panel1.Top = btnVerins.Top
  • Panel2.Height = btnPompes.Height : Panel2.Top = Panel1.Top + btnVerins.Height
  • Panel3.Height = btnMoteurs.Height : Panel3.Top = Panel2.Top + btnPompes.Height
  • Panel4.Height = _Height4 : Panel4.Top = Panel3.Top + btnMoteurs.Height
  • End Sub
  • Sub Fermer_Distributeur()
  • ' On fixe l'état du bouton et l'image a charger
  • _btnEtat4 = False : btnDistributeurs.Image = Image.FromFile("Images\_btnDistributeurs_OFF.bmp")
  • ' On dispose les controls de la bonne manière.
  • Panel1.Height = btnVerins.Height : Panel1.Top = btnVerins.Top
  • Panel2.Height = btnPompes.Height : Panel2.Top = Panel1.Top + btnVerins.Height - 1
  • Panel3.Height = btnMoteurs.Height : Panel3.Top = Panel2.Top + btnPompes.Height - 1
  • Panel4.Height = btnDistributeurs.Height : Panel4.Top = Panel3.Top + btnMoteurs.Height - 1
  • End Sub
  • #End Region
#Region "MenuComposant"
        Public Sub MenuComposant(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnVerins.Click, btnPompes.Click, btnMoteurs.Click, btnDistributeurs.Click
            ' On récupère le nom du bouton et suivant sont état (true = ouvert; false = fermer)
            ' on affiche le menu.
            If sender.name = "btnVerins" Then
                If _btnEtat = False Then
                    Fermer_Pompe() : Fermer_Moteur() : Fermer_Distributeur()
                    Ouvrir_Verin()
                ElseIf _btnEtat = True Then
                    Fermer_Verin()
                End If

            ElseIf sender.name = "btnPompes" Then
                If _btnEtat2 = False Then
                    Fermer_Verin() : Fermer_Moteur() : Fermer_Distributeur()
                    Ouvrir_Pompe()
                ElseIf _btnEtat2 = True Then
                    Fermer_Pompe()
                End If

            ElseIf sender.name = "btnMoteurs" Then
                If _btnEtat3 = False Then
                    Fermer_Pompe() : Fermer_Verin() : Fermer_Distributeur()
                    Ouvrir_Moteur()
                ElseIf _btnEtat3 Then
                    Fermer_Moteur()
                End If

            ElseIf sender.name = "btnDistributeurs" Then
                If _btnEtat4 = False Then
                    Fermer_Pompe() : Fermer_Moteur() : Fermer_Verin()
                    Ouvrir_Distributeur()
                ElseIf _btnEtat4 = True Then
                    Fermer_Distributeur()
                End If
            End If
        End Sub

        Sub Ouvrir_Verin()
            ' On fixe l'état du bouton et l'image a charger.
            _btnEtat = True : btnVerins.Image = Image.FromFile("Images\_btnVerins_ON.bmp")
            ' On dispose les controls de la bonne manière.
            Panel1.Height = _Height : Panel1.Top = btnVerins.Top
            Panel2.Height = btnPompes.Height : Panel2.Top = Panel1.Top + Panel1.Height
            Panel3.Height = btnMoteurs.Height : Panel3.Top = Panel2.Top + btnPompes.Height
            Panel4.Height = btnDistributeurs.Height : Panel4.Top = Panel3.Top + btnMoteurs.Height
        End Sub
        Sub Fermer_Verin()
            ' On fixe l'état du bouton et l'image a charger
            _btnEtat = False : btnVerins.Image = Image.FromFile("Images\_btnVerins_OFF.bmp")
            ' On dispose les controls de la bonne manière.
            Panel1.Height = btnVerins.Height : Panel1.Top = btnVerins.Top
            Panel2.Height = btnPompes.Height : Panel2.Top = Panel1.Top + btnVerins.Height - 1
            Panel3.Height = btnMoteurs.Height : Panel3.Top = Panel2.Top + btnPompes.Height - 1
            Panel4.Height = btnDistributeurs.Height : Panel4.Top = Panel3.Top + btnMoteurs.Height - 1
        End Sub

        Sub Ouvrir_Pompe()
            ' On fixe l'état du bouton et l'image a charger
            _btnEtat2 = True : btnPompes.Image = Image.FromFile("Images\_btnPompes_ON.bmp")
            ' On dispose les controls de la bonne manière.
            Panel1.Height = btnVerins.Height : Panel1.Top = btnVerins.Top
            Panel2.Height = _Height2 : Panel2.Top = Panel1.Top + btnVerins.Height
            Panel3.Height = btnMoteurs.Height : Panel3.Top = Panel2.Top + Panel2.Height
            Panel4.Height = btnDistributeurs.Height : Panel4.Top = Panel3.Top + Panel3.Height
        End Sub
        Sub Fermer_Pompe()
            ' On fixe l'état du bouton et l'image a charger
            _btnEtat2 = False : btnPompes.Image = Image.FromFile("Images\_btnPompes_OFF.bmp")
            ' On dispose les controls de la bonne manière.
            Panel1.Height = btnVerins.Height : Panel1.Top = btnVerins.Top
            Panel2.Height = btnPompes.Height : Panel2.Top = Panel1.Top + btnVerins.Height - 1
            Panel3.Height = btnMoteurs.Height : Panel3.Top = Panel2.Top + btnPompes.Height - 1
            Panel4.Height = btnDistributeurs.Height : Panel4.Top = Panel3.Top + btnMoteurs.Height - 1
        End Sub

        Sub Ouvrir_Moteur()
            ' On fixe l'état du bouton et l'image a charger
            _btnEtat3 = True : btnMoteurs.Image = Image.FromFile("Images\_btnMoteurs_ON.bmp")
            ' On dispose les controls de la bonne manière.
            Panel1.Height = btnVerins.Height : Panel1.Top = btnVerins.Top
            Panel2.Height = btnPompes.Height : Panel2.Top = Panel1.Top + btnVerins.Height
            Panel3.Height = _Height3 : Panel3.Top = Panel2.Top + btnPompes.Height
            Panel4.Height = btnDistributeurs.Height : Panel4.Top = Panel3.Top + Panel3.Height
        End Sub
        Sub Fermer_Moteur()
            ' On fixe l'état du bouton et l'image a charger
            _btnEtat3 = False : btnMoteurs.Image = Image.FromFile("Images\_btnMoteurs_OFF.bmp")
            ' On dispose les controls de la bonne manière.
            Panel1.Height = btnVerins.Height : Panel1.Top = btnVerins.Top
            Panel2.Height = btnPompes.Height : Panel2.Top = Panel1.Top + btnVerins.Height - 1
            Panel3.Height = btnMoteurs.Height : Panel3.Top = Panel2.Top + btnPompes.Height - 1
            Panel4.Height = btnDistributeurs.Height : Panel4.Top = Panel3.Top + btnMoteurs.Height - 1
        End Sub

        Sub Ouvrir_Distributeur()
            ' On fixe l'état du bouton et l'image a charger
            _btnEtat4 = True : btnDistributeurs.Image = Image.FromFile("Images\_btnDistributeurs_ON.bmp")
            ' On dispose les controls de la bonne manière.
            Panel1.Height = btnVerins.Height : Panel1.Top = btnVerins.Top
            Panel2.Height = btnPompes.Height : Panel2.Top = Panel1.Top + btnVerins.Height
            Panel3.Height = btnMoteurs.Height : Panel3.Top = Panel2.Top + btnPompes.Height
            Panel4.Height = _Height4 : Panel4.Top = Panel3.Top + btnMoteurs.Height
        End Sub
        Sub Fermer_Distributeur()
            ' On fixe l'état du bouton et l'image a charger
            _btnEtat4 = False : btnDistributeurs.Image = Image.FromFile("Images\_btnDistributeurs_OFF.bmp")
            ' On dispose les controls de la bonne manière.
            Panel1.Height = btnVerins.Height : Panel1.Top = btnVerins.Top
            Panel2.Height = btnPompes.Height : Panel2.Top = Panel1.Top + btnVerins.Height - 1
            Panel3.Height = btnMoteurs.Height : Panel3.Top = Panel2.Top + btnPompes.Height - 1
            Panel4.Height = btnDistributeurs.Height : Panel4.Top = Panel3.Top + btnMoteurs.Height - 1
        End Sub
#End Region

Historique

27 mai 2005 11:31:10 :
Je viens de changer le code, le 26/05/2005 car l'algo de repositionnement des panels était un peu freestyle. Donc maintenant c bon, et si vous avez bien saisi le principe vous n'aurez aucun problème a dupliquer le systeme panel/bouton pour faire plus d'onglets que les 4 présents.

Commentaires et avis

signaler à un administrateur
Commentaire de lordskyser1 le 01/06/2005 12:42:02

Bonjour, le résultat a l'air sympa, mais je ne l'ai pas testé car je n'ai pas vu le zip. J'ai enregistré le code mais je n'ai pas le temps de l'insérer dans un projet et de tester. Donc je te metrai une note (surement bonne) lorsque tu auras ajouté un zip et que je pourrais tester. Voilà, continue comme çà, bonne prog

signaler à un administrateur
Commentaire de Hiomikil le 20/04/2006 14:34:42

j' ai le ^meme problem de  lordskyser1 donc, je veut si tu peut m'envoi le zip
ou le solution Mr  lordskyser1 .
merci en avance

Ajouter un commentaire

Discussions en rapport avec ce code source dans le forum

tabcontrol vertical [ par tump ] bonjourje souhaite mettre sur ma form un genre de tabcontrol, mais a la verticale,comme la boite a outil vb.net par exemple! quel est le nom de ce con problème usercontrol [ par tmcuh ] Voil&#224; mon probl&#232;me r&#233;side dans la restitution des attributs. J'ai cr&#233;e un controle avec une image dedans, une liste enum&#233;rati ajout d'une scrollBar vertical si trop de controle ajouter dynamiquement [ par youkizouki ] &nbsp;bonjour, &nbsp;<SPAN lang=FR style="mso Pb de TabControl en VB.Net [ par chris81 ] bonjour, comment puis je faire pour ouvrir l'onglet que je veux d'un tabcontrol? mercihttp://www.correzeweb.comhttp://www.localetv.com creer un usercontrol [ par mikoteam ] bonjours a tous je voudrais creer un truc simple pour grand nombre d entre vous mais tres dur pour moi&nbsp;&nbsp;&nbsp; j aimerais cr&#233;er un user Texte défilement Vertical + VBA [ par Cruzerlord ] Bonjour est il possible de faire un texte d&#233;filant verticalement sur VBASi oui pouvez vous me dire comment on fait mercim&#234;me Question pour u VB.NET Usercontrol et backcolor transparent [ par liquide ] Salut a tous,(VB.Net 2005 Edition Beta)je cherche la possibilit&#233; sur un Usercontrol de le rendre transparent en backcolor, la methode du Backcolo Drag drop dans un activeX [ par vfi ] Bonjour,J'ai un projet VB6 , contenant une form et un usercontrol.Sur ma form, j'ai un label et le usersercontrol.Dans mon usercontrol j'ai un autre l [ocx] Texte vertical [ par moony01 ] bonsoirJe cherche un ocx pour afficher du texte vertical dans un fomulaire access 2000.Merci d'avance.Moony. onglet (tabcontrol) sur condition (dans access) [ par l_apotre ] Voila mon probleme : je souhaiterai afficher des onglets suivants un premier onglet de configuration : En fait, suivant des champs de qualification du


Nos sponsors

Sondage...

CalendriCode

Juillet 2009
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
2728293031  

Consulter la suite du CalendriCode

Téléchargements

Logiciels à télécharger sur le même thème :

Comparez les prix Nouvelle version


LG KP501

Entre 9€ et 159€


Photothèque Nouveau !



Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés
Temps d'éxécution de la page : 0,406 sec

Google Coop CodeS-SourceS Google Coop CodeS-SourceS


Certaines images présentes sur le site (notament certains avatars) sont issues des collections IconShock, donc si vous souhaitez utiliser ces icons vous devez les acheter, ne les copiez pas et ne utilisez pas dans vos sites et applications sans les avoir commandé.