WizardXpUserControl.cs
Description du code
WizardXpUserControl.cs est un fichier du projet BrolDev.Ce fichier est situé dans /var/www/bin/sniplets/bibliobrol/broldev/src/.
Projet BrolDev : Librairie de composants réutilisables pour les applications BrolDev en CSharp.
Code source ou contenu du fichier
Code c# (WizardXpUserControl.cs) (207 lignes)
using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; using be.gaudry.notsafe.XPExplorerBar; namespace be.gaudry.view.controls { public partial class WizardXpUserControl : UserControl, IWizardUC { private List<StepControl> stepControls; private int index; public WizardXpUserControl() { index = 0; InitializeComponent(); testOS(); } private void testOS() { switch (Environment.OSVersion.Platform) { case PlatformID.Win32NT : if (Environment.OSVersion.Version.Major == 6) { if (be.gaudry.view.style.XpStyle.IsThemeActive()) { //splitContainer1.SplitterDistance = 0; splitContainer1.Panel1Collapsed = true; } } break; } } /// <summary> /// Display current action and execute previous action if needed /// </summary> /// <param name="actionIndex">(int) new action index</param> public void displayAction(int actionIndex) { if (actionIndex >= 0 && actionIndex <= stepControls.Count) { //execute previous action if needed if (actionIndex != index) { if(stepControls[index].eventHandler!=null) stepControls[index].expandoBtn.Visible = true; //set new index index = actionIndex; } //expand only curent expando this.taskPane1.CollapseAllButOne(stepControls[index].expando); stepControls[index].expandoBtn.Visible = false; //set action panel actionsPanel.Controls.Clear(); actionsPanel.Controls.Add(stepControls[index].control); //check action navigation buttons enableActions(); } } /// <summary> /// Add an action panel /// </summary> /// <param name="content">(String) Info to display on the right panel</param> /// <param name="title">(String) title of the action</param> /// <param name="info">(String) info about the action</param> public void addStepControl(String content, String title, String info) { //todo : place content on a InfoControl } /// <summary> /// Add an action panel /// </summary> /// <param name="control">(Control) action panel (may be a usercontrol)</param> /// <param name="title">(String) title of the action</param> /// <param name="info">(String) info about the action</param> public void addStepControl(Control control, String title, String info) { addStepControl(control, null, title, info); } /// <summary> /// Add an action panel /// </summary> /// <param name="control">(Control) action panel (may be a usercontrol)</param> /// <param name="eventHandler">(EventHandler) eventHandler to execute</param> /// <param name="title">(String) title of the action</param> /// <param name="info">(String) info about the action</param> public void addStepControl(Control control, EventHandler eventHandler, String title, String info) { addStepControl(control, eventHandler, title, info, null, null); } /// <summary> /// Add an action panel /// </summary> /// <param name="control">(Control) action panel (may be a usercontrol)</param> /// <param name="eventHandler">(EventHandler) eventHandler to execute</param> /// <param name="title">(String) title of the action</param> /// <param name="info">(String) info about the action</param> /// <param name="titleImage">(Image) Image to display on the title bar</param> /// <param name="watermark">(Image) Image to display as watermak on the body of the action item</param> public void addStepControl(Control control, EventHandler eventHandler, String title, String info, Image titleImage, Image watermark) { //set label expandoLbl.Dock = DockStyle.Top; expandoLbl.AutoSize = true; expandoLbl.Text = info; //set button //expandoBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); expandoBtn.Text = "Afficher"; expandoBtn.UseVisualStyleBackColor = true; int i = stepControls.Count; expandoBtn.Click += delegate { displayAction(i); }; /*((System.ComponentModel.ISupportInitialize)(this.taskPane1)).BeginInit(); this.taskPane1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(expando)).BeginInit(); expando.SuspendLayout();*/ //set expando this.taskPane1.Expandos.Add(expando); expando.AutoLayout = true; expando.Collapsed = true; if (titleImage != null) expando.TitleImage = titleImage; if (watermark != null) expando.Watermark = watermark; expando.Items.Add(expandoLbl); expando.Items.Add(expandoBtn); expando.Text = title; /*this.taskPane1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(expando)).EndInit(); expando.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.taskPane1)).EndInit(); this.taskPane1.ResumeLayout(false);*/ control.Dock = DockStyle.Fill; ((UserControl)control).AutoScroll = true; } private void actNextBtn_Click(object sender, EventArgs e) { displayAction(index+1); } private void actPrevBtn_Click(object sender, EventArgs e) { displayAction(index-1); } private void enableActions() { actPrevBtn.Enabled = (index > 0); actNextBtn.Enabled = (index < stepControls.Count-1); } protected class StepControl { public Control control; public EventHandler eventHandler; public Expando expando; public Button expandoBtn; public StepControl(Control control, EventHandler eventHandler, Expando expando, Button expandoBtn) { this.control = control; this.eventHandler = eventHandler; this.expando = expando; this.expandoBtn = expandoBtn; } } private void WizardUserControl_Load(object sender, EventArgs e) { this.ParentForm.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ParentForm_FormClosing); } private void ParentForm_FormClosing(object sender, FormClosingEventArgs e) { //execute modifications if needed if(stepControls[index].eventHandler!=null) } } }
Structure et Fichiers du projet
Afficher/masquer...Icône | Nom | Taille | Modification |
Pas de sous-répertoires. | |||
Icône | Nom | Taille | Modification |
| _ | Répertoire parent | 0 octets | 1732518420 25/11/2024 08:07:00 |
Utilisation de l'explorateur de code
- Navigation :
- Un clic sur une icône de répertoire ouvre ce répertoire pour en afficher les fichiers.
- Lorsque le répertoire en cours ne contient pas de sous-répertoires il est possible de remonter vers le répertoire parent.
- La structure de répertoires en treetable (tableau en forme d'arborescence) n'est plus possibledans cette version.
- Un clic sur une icône de fichier ouvre ce fichier pour en afficher le code avec la coloration syntaxique adaptée en fonction du langage principal utilisé dans le fichier.
- Affichage :
- Il est possible de trier les répertoires ou les fichiers selon certains critères (nom, taille, date).
- Actions :
- Les actions possible sur les fichiers dépendent de vos droits d'utilisateur sur le site. Veuillez activer le mode utilisateur pour activer les actions.
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 16/10/2009, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/cs-broldev-source-rf-view/controls/WizardXpUserControl.cs.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.